@unifiedsoftware/react-ui 1.0.1 → 1.0.3
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +18 -1100
- package/dist/index.mjs +26 -1108
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -37,9 +37,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
37
37
|
var prefixCls = "us-";
|
|
38
38
|
var Button = forwardRef(
|
|
39
39
|
(_a, ref) => {
|
|
40
|
-
var _b = _a, { as:
|
|
40
|
+
var _b = _a, { as: Component = "button", children, className, variant = "text", color = "primary", size = "md" } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
41
41
|
return /* @__PURE__ */ jsxs(
|
|
42
|
-
|
|
42
|
+
Component,
|
|
43
43
|
__spreadProps(__spreadValues({
|
|
44
44
|
ref,
|
|
45
45
|
className: clsx(
|
|
@@ -83,7 +83,7 @@ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
|
83
83
|
var prefixCls2 = "us-";
|
|
84
84
|
var Tab = forwardRef2(
|
|
85
85
|
(_a, ref) => {
|
|
86
|
-
var _b = _a, { as:
|
|
86
|
+
var _b = _a, { as: Component = "div", children, className, value, onClick } = _b, rest = __objRest(_b, ["as", "children", "className", "value", "onClick"]);
|
|
87
87
|
const tabRef = useRef(null);
|
|
88
88
|
const tabs = useTabs();
|
|
89
89
|
const handleClick = (event) => {
|
|
@@ -126,7 +126,7 @@ var Tab = forwardRef2(
|
|
|
126
126
|
}
|
|
127
127
|
}, []);
|
|
128
128
|
return /* @__PURE__ */ jsx2(
|
|
129
|
-
|
|
129
|
+
Component,
|
|
130
130
|
__spreadProps(__spreadValues({
|
|
131
131
|
ref: mergeRefs(tabRef, ref),
|
|
132
132
|
className: clsx2(`${prefixCls2}tab`, { [`${prefixCls2}tab--selected`]: value === tabs.value }, className),
|
|
@@ -439,1058 +439,10 @@ var useStep = (maxStep) => {
|
|
|
439
439
|
};
|
|
440
440
|
|
|
441
441
|
// src/layout/AppBreadcrumb.tsx
|
|
442
|
-
import { useContext as
|
|
442
|
+
import { useContext as useContext2, useEffect as useEffect7 } from "react";
|
|
443
443
|
import { MdClose } from "react-icons/md";
|
|
444
444
|
import { VscChevronRight } from "react-icons/vsc";
|
|
445
|
-
|
|
446
|
-
// ../../../node_modules/react-router-dom/dist/index.js
|
|
447
|
-
import * as React2 from "react";
|
|
448
|
-
|
|
449
|
-
// ../../../node_modules/react-router/dist/index.js
|
|
450
|
-
import * as React from "react";
|
|
451
|
-
|
|
452
|
-
// ../../../node_modules/@remix-run/router/dist/router.js
|
|
453
|
-
function _extends() {
|
|
454
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
455
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
456
|
-
var source = arguments[i];
|
|
457
|
-
for (var key in source) {
|
|
458
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
459
|
-
target[key] = source[key];
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
return target;
|
|
464
|
-
};
|
|
465
|
-
return _extends.apply(this, arguments);
|
|
466
|
-
}
|
|
467
|
-
var Action;
|
|
468
|
-
(function(Action2) {
|
|
469
|
-
Action2["Pop"] = "POP";
|
|
470
|
-
Action2["Push"] = "PUSH";
|
|
471
|
-
Action2["Replace"] = "REPLACE";
|
|
472
|
-
})(Action || (Action = {}));
|
|
473
|
-
function invariant(value, message) {
|
|
474
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
475
|
-
throw new Error(message);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
function warning(cond, message) {
|
|
479
|
-
if (!cond) {
|
|
480
|
-
if (typeof console !== "undefined")
|
|
481
|
-
console.warn(message);
|
|
482
|
-
try {
|
|
483
|
-
throw new Error(message);
|
|
484
|
-
} catch (e) {
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
function createPath(_ref) {
|
|
489
|
-
let {
|
|
490
|
-
pathname = "/",
|
|
491
|
-
search = "",
|
|
492
|
-
hash = ""
|
|
493
|
-
} = _ref;
|
|
494
|
-
if (search && search !== "?")
|
|
495
|
-
pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
496
|
-
if (hash && hash !== "#")
|
|
497
|
-
pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
498
|
-
return pathname;
|
|
499
|
-
}
|
|
500
|
-
function parsePath(path) {
|
|
501
|
-
let parsedPath = {};
|
|
502
|
-
if (path) {
|
|
503
|
-
let hashIndex = path.indexOf("#");
|
|
504
|
-
if (hashIndex >= 0) {
|
|
505
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
506
|
-
path = path.substr(0, hashIndex);
|
|
507
|
-
}
|
|
508
|
-
let searchIndex = path.indexOf("?");
|
|
509
|
-
if (searchIndex >= 0) {
|
|
510
|
-
parsedPath.search = path.substr(searchIndex);
|
|
511
|
-
path = path.substr(0, searchIndex);
|
|
512
|
-
}
|
|
513
|
-
if (path) {
|
|
514
|
-
parsedPath.pathname = path;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return parsedPath;
|
|
518
|
-
}
|
|
519
|
-
var ResultType;
|
|
520
|
-
(function(ResultType2) {
|
|
521
|
-
ResultType2["data"] = "data";
|
|
522
|
-
ResultType2["deferred"] = "deferred";
|
|
523
|
-
ResultType2["redirect"] = "redirect";
|
|
524
|
-
ResultType2["error"] = "error";
|
|
525
|
-
})(ResultType || (ResultType = {}));
|
|
526
|
-
function convertRouteMatchToUiMatch(match, loaderData) {
|
|
527
|
-
let {
|
|
528
|
-
route,
|
|
529
|
-
pathname,
|
|
530
|
-
params
|
|
531
|
-
} = match;
|
|
532
|
-
return {
|
|
533
|
-
id: route.id,
|
|
534
|
-
pathname,
|
|
535
|
-
params,
|
|
536
|
-
data: loaderData[route.id],
|
|
537
|
-
handle: route.handle
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
function stripBasename(pathname, basename) {
|
|
541
|
-
if (basename === "/")
|
|
542
|
-
return pathname;
|
|
543
|
-
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
544
|
-
return null;
|
|
545
|
-
}
|
|
546
|
-
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
547
|
-
let nextChar = pathname.charAt(startIndex);
|
|
548
|
-
if (nextChar && nextChar !== "/") {
|
|
549
|
-
return null;
|
|
550
|
-
}
|
|
551
|
-
return pathname.slice(startIndex) || "/";
|
|
552
|
-
}
|
|
553
|
-
function resolvePath(to, fromPathname) {
|
|
554
|
-
if (fromPathname === void 0) {
|
|
555
|
-
fromPathname = "/";
|
|
556
|
-
}
|
|
557
|
-
let {
|
|
558
|
-
pathname: toPathname,
|
|
559
|
-
search = "",
|
|
560
|
-
hash = ""
|
|
561
|
-
} = typeof to === "string" ? parsePath(to) : to;
|
|
562
|
-
let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
|
|
563
|
-
return {
|
|
564
|
-
pathname,
|
|
565
|
-
search: normalizeSearch(search),
|
|
566
|
-
hash: normalizeHash(hash)
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
function resolvePathname(relativePath, fromPathname) {
|
|
570
|
-
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
571
|
-
let relativeSegments = relativePath.split("/");
|
|
572
|
-
relativeSegments.forEach((segment) => {
|
|
573
|
-
if (segment === "..") {
|
|
574
|
-
if (segments.length > 1)
|
|
575
|
-
segments.pop();
|
|
576
|
-
} else if (segment !== ".") {
|
|
577
|
-
segments.push(segment);
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
return segments.length > 1 ? segments.join("/") : "/";
|
|
581
|
-
}
|
|
582
|
-
function getInvalidPathError(char, field, dest, path) {
|
|
583
|
-
return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
|
|
584
|
-
}
|
|
585
|
-
function getPathContributingMatches(matches) {
|
|
586
|
-
return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
|
|
587
|
-
}
|
|
588
|
-
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
|
|
589
|
-
if (isPathRelative === void 0) {
|
|
590
|
-
isPathRelative = false;
|
|
591
|
-
}
|
|
592
|
-
let to;
|
|
593
|
-
if (typeof toArg === "string") {
|
|
594
|
-
to = parsePath(toArg);
|
|
595
|
-
} else {
|
|
596
|
-
to = _extends({}, toArg);
|
|
597
|
-
invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
|
|
598
|
-
invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
|
|
599
|
-
invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
|
|
600
|
-
}
|
|
601
|
-
let isEmptyPath = toArg === "" || to.pathname === "";
|
|
602
|
-
let toPathname = isEmptyPath ? "/" : to.pathname;
|
|
603
|
-
let from;
|
|
604
|
-
if (isPathRelative || toPathname == null) {
|
|
605
|
-
from = locationPathname;
|
|
606
|
-
} else {
|
|
607
|
-
let routePathnameIndex = routePathnames.length - 1;
|
|
608
|
-
if (toPathname.startsWith("..")) {
|
|
609
|
-
let toSegments = toPathname.split("/");
|
|
610
|
-
while (toSegments[0] === "..") {
|
|
611
|
-
toSegments.shift();
|
|
612
|
-
routePathnameIndex -= 1;
|
|
613
|
-
}
|
|
614
|
-
to.pathname = toSegments.join("/");
|
|
615
|
-
}
|
|
616
|
-
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
617
|
-
}
|
|
618
|
-
let path = resolvePath(to, from);
|
|
619
|
-
let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
|
|
620
|
-
let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
621
|
-
if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
|
|
622
|
-
path.pathname += "/";
|
|
623
|
-
}
|
|
624
|
-
return path;
|
|
625
|
-
}
|
|
626
|
-
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
627
|
-
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
628
|
-
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
629
|
-
var validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
630
|
-
var validMutationMethods = new Set(validMutationMethodsArr);
|
|
631
|
-
var validRequestMethodsArr = ["get", ...validMutationMethodsArr];
|
|
632
|
-
var validRequestMethods = new Set(validRequestMethodsArr);
|
|
633
|
-
var UNSAFE_DEFERRED_SYMBOL = Symbol("deferred");
|
|
634
|
-
|
|
635
|
-
// ../../../node_modules/react-router/dist/index.js
|
|
636
|
-
function _extends2() {
|
|
637
|
-
_extends2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
638
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
639
|
-
var source = arguments[i];
|
|
640
|
-
for (var key in source) {
|
|
641
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
642
|
-
target[key] = source[key];
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
return target;
|
|
647
|
-
};
|
|
648
|
-
return _extends2.apply(this, arguments);
|
|
649
|
-
}
|
|
650
|
-
var DataRouterContext = /* @__PURE__ */ React.createContext(null);
|
|
651
|
-
if (process.env.NODE_ENV !== "production") {
|
|
652
|
-
DataRouterContext.displayName = "DataRouter";
|
|
653
|
-
}
|
|
654
|
-
var DataRouterStateContext = /* @__PURE__ */ React.createContext(null);
|
|
655
|
-
if (process.env.NODE_ENV !== "production") {
|
|
656
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
657
|
-
}
|
|
658
|
-
var AwaitContext = /* @__PURE__ */ React.createContext(null);
|
|
659
|
-
if (process.env.NODE_ENV !== "production") {
|
|
660
|
-
AwaitContext.displayName = "Await";
|
|
661
|
-
}
|
|
662
|
-
var NavigationContext = /* @__PURE__ */ React.createContext(null);
|
|
663
|
-
if (process.env.NODE_ENV !== "production") {
|
|
664
|
-
NavigationContext.displayName = "Navigation";
|
|
665
|
-
}
|
|
666
|
-
var LocationContext = /* @__PURE__ */ React.createContext(null);
|
|
667
|
-
if (process.env.NODE_ENV !== "production") {
|
|
668
|
-
LocationContext.displayName = "Location";
|
|
669
|
-
}
|
|
670
|
-
var RouteContext = /* @__PURE__ */ React.createContext({
|
|
671
|
-
outlet: null,
|
|
672
|
-
matches: [],
|
|
673
|
-
isDataRoute: false
|
|
674
|
-
});
|
|
675
|
-
if (process.env.NODE_ENV !== "production") {
|
|
676
|
-
RouteContext.displayName = "Route";
|
|
677
|
-
}
|
|
678
|
-
var RouteErrorContext = /* @__PURE__ */ React.createContext(null);
|
|
679
|
-
if (process.env.NODE_ENV !== "production") {
|
|
680
|
-
RouteErrorContext.displayName = "RouteError";
|
|
681
|
-
}
|
|
682
|
-
function useHref(to, _temp) {
|
|
683
|
-
let {
|
|
684
|
-
relative
|
|
685
|
-
} = _temp === void 0 ? {} : _temp;
|
|
686
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
|
|
687
|
-
false,
|
|
688
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
689
|
-
// router loaded. We can help them understand how to avoid that.
|
|
690
|
-
"useHref() may be used only in the context of a <Router> component."
|
|
691
|
-
) : invariant(false) : void 0;
|
|
692
|
-
let {
|
|
693
|
-
basename,
|
|
694
|
-
navigator
|
|
695
|
-
} = React.useContext(NavigationContext);
|
|
696
|
-
let {
|
|
697
|
-
hash,
|
|
698
|
-
pathname,
|
|
699
|
-
search
|
|
700
|
-
} = useResolvedPath(to, {
|
|
701
|
-
relative
|
|
702
|
-
});
|
|
703
|
-
let joinedPathname = pathname;
|
|
704
|
-
if (basename !== "/") {
|
|
705
|
-
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
706
|
-
}
|
|
707
|
-
return navigator.createHref({
|
|
708
|
-
pathname: joinedPathname,
|
|
709
|
-
search,
|
|
710
|
-
hash
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
function useInRouterContext() {
|
|
714
|
-
return React.useContext(LocationContext) != null;
|
|
715
|
-
}
|
|
716
|
-
function useLocation() {
|
|
717
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
|
|
718
|
-
false,
|
|
719
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
720
|
-
// router loaded. We can help them understand how to avoid that.
|
|
721
|
-
"useLocation() may be used only in the context of a <Router> component."
|
|
722
|
-
) : invariant(false) : void 0;
|
|
723
|
-
return React.useContext(LocationContext).location;
|
|
724
|
-
}
|
|
725
|
-
var navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
726
|
-
function useIsomorphicLayoutEffect2(cb) {
|
|
727
|
-
let isStatic = React.useContext(NavigationContext).static;
|
|
728
|
-
if (!isStatic) {
|
|
729
|
-
React.useLayoutEffect(cb);
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
function useNavigate() {
|
|
733
|
-
let {
|
|
734
|
-
isDataRoute
|
|
735
|
-
} = React.useContext(RouteContext);
|
|
736
|
-
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
737
|
-
}
|
|
738
|
-
function useNavigateUnstable() {
|
|
739
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
|
|
740
|
-
false,
|
|
741
|
-
// TODO: This error is probably because they somehow have 2 versions of the
|
|
742
|
-
// router loaded. We can help them understand how to avoid that.
|
|
743
|
-
"useNavigate() may be used only in the context of a <Router> component."
|
|
744
|
-
) : invariant(false) : void 0;
|
|
745
|
-
let dataRouterContext = React.useContext(DataRouterContext);
|
|
746
|
-
let {
|
|
747
|
-
basename,
|
|
748
|
-
navigator
|
|
749
|
-
} = React.useContext(NavigationContext);
|
|
750
|
-
let {
|
|
751
|
-
matches
|
|
752
|
-
} = React.useContext(RouteContext);
|
|
753
|
-
let {
|
|
754
|
-
pathname: locationPathname
|
|
755
|
-
} = useLocation();
|
|
756
|
-
let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase));
|
|
757
|
-
let activeRef = React.useRef(false);
|
|
758
|
-
useIsomorphicLayoutEffect2(() => {
|
|
759
|
-
activeRef.current = true;
|
|
760
|
-
});
|
|
761
|
-
let navigate = React.useCallback(function(to, options) {
|
|
762
|
-
if (options === void 0) {
|
|
763
|
-
options = {};
|
|
764
|
-
}
|
|
765
|
-
process.env.NODE_ENV !== "production" ? warning(activeRef.current, navigateEffectWarning) : void 0;
|
|
766
|
-
if (!activeRef.current)
|
|
767
|
-
return;
|
|
768
|
-
if (typeof to === "number") {
|
|
769
|
-
navigator.go(to);
|
|
770
|
-
return;
|
|
771
|
-
}
|
|
772
|
-
let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
|
|
773
|
-
if (dataRouterContext == null && basename !== "/") {
|
|
774
|
-
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
775
|
-
}
|
|
776
|
-
(!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
|
|
777
|
-
}, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);
|
|
778
|
-
return navigate;
|
|
779
|
-
}
|
|
780
|
-
function useResolvedPath(to, _temp2) {
|
|
781
|
-
let {
|
|
782
|
-
relative
|
|
783
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
784
|
-
let {
|
|
785
|
-
matches
|
|
786
|
-
} = React.useContext(RouteContext);
|
|
787
|
-
let {
|
|
788
|
-
pathname: locationPathname
|
|
789
|
-
} = useLocation();
|
|
790
|
-
let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map((match) => match.pathnameBase));
|
|
791
|
-
return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
|
|
792
|
-
}
|
|
793
|
-
var DataRouterHook = /* @__PURE__ */ function(DataRouterHook3) {
|
|
794
|
-
DataRouterHook3["UseBlocker"] = "useBlocker";
|
|
795
|
-
DataRouterHook3["UseRevalidator"] = "useRevalidator";
|
|
796
|
-
DataRouterHook3["UseNavigateStable"] = "useNavigate";
|
|
797
|
-
return DataRouterHook3;
|
|
798
|
-
}(DataRouterHook || {});
|
|
799
|
-
var DataRouterStateHook = /* @__PURE__ */ function(DataRouterStateHook3) {
|
|
800
|
-
DataRouterStateHook3["UseBlocker"] = "useBlocker";
|
|
801
|
-
DataRouterStateHook3["UseLoaderData"] = "useLoaderData";
|
|
802
|
-
DataRouterStateHook3["UseActionData"] = "useActionData";
|
|
803
|
-
DataRouterStateHook3["UseRouteError"] = "useRouteError";
|
|
804
|
-
DataRouterStateHook3["UseNavigation"] = "useNavigation";
|
|
805
|
-
DataRouterStateHook3["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
806
|
-
DataRouterStateHook3["UseMatches"] = "useMatches";
|
|
807
|
-
DataRouterStateHook3["UseRevalidator"] = "useRevalidator";
|
|
808
|
-
DataRouterStateHook3["UseNavigateStable"] = "useNavigate";
|
|
809
|
-
DataRouterStateHook3["UseRouteId"] = "useRouteId";
|
|
810
|
-
return DataRouterStateHook3;
|
|
811
|
-
}(DataRouterStateHook || {});
|
|
812
|
-
function getDataRouterConsoleError(hookName) {
|
|
813
|
-
return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
|
814
|
-
}
|
|
815
|
-
function useDataRouterContext(hookName) {
|
|
816
|
-
let ctx = React.useContext(DataRouterContext);
|
|
817
|
-
!ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
818
|
-
return ctx;
|
|
819
|
-
}
|
|
820
|
-
function useDataRouterState(hookName) {
|
|
821
|
-
let state = React.useContext(DataRouterStateContext);
|
|
822
|
-
!state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
823
|
-
return state;
|
|
824
|
-
}
|
|
825
|
-
function useRouteContext(hookName) {
|
|
826
|
-
let route = React.useContext(RouteContext);
|
|
827
|
-
!route ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
|
|
828
|
-
return route;
|
|
829
|
-
}
|
|
830
|
-
function useCurrentRouteId(hookName) {
|
|
831
|
-
let route = useRouteContext(hookName);
|
|
832
|
-
let thisRoute = route.matches[route.matches.length - 1];
|
|
833
|
-
!thisRoute.route.id ? process.env.NODE_ENV !== "production" ? invariant(false, hookName + ' can only be used on routes that contain a unique "id"') : invariant(false) : void 0;
|
|
834
|
-
return thisRoute.route.id;
|
|
835
|
-
}
|
|
836
|
-
function useRouteId() {
|
|
837
|
-
return useCurrentRouteId(DataRouterStateHook.UseRouteId);
|
|
838
|
-
}
|
|
839
|
-
function useNavigation() {
|
|
840
|
-
let state = useDataRouterState(DataRouterStateHook.UseNavigation);
|
|
841
|
-
return state.navigation;
|
|
842
|
-
}
|
|
843
|
-
function useMatches() {
|
|
844
|
-
let {
|
|
845
|
-
matches,
|
|
846
|
-
loaderData
|
|
847
|
-
} = useDataRouterState(DataRouterStateHook.UseMatches);
|
|
848
|
-
return React.useMemo(() => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
|
|
849
|
-
}
|
|
850
|
-
function useNavigateStable() {
|
|
851
|
-
let {
|
|
852
|
-
router
|
|
853
|
-
} = useDataRouterContext(DataRouterHook.UseNavigateStable);
|
|
854
|
-
let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
|
|
855
|
-
let activeRef = React.useRef(false);
|
|
856
|
-
useIsomorphicLayoutEffect2(() => {
|
|
857
|
-
activeRef.current = true;
|
|
858
|
-
});
|
|
859
|
-
let navigate = React.useCallback(function(to, options) {
|
|
860
|
-
if (options === void 0) {
|
|
861
|
-
options = {};
|
|
862
|
-
}
|
|
863
|
-
process.env.NODE_ENV !== "production" ? warning(activeRef.current, navigateEffectWarning) : void 0;
|
|
864
|
-
if (!activeRef.current)
|
|
865
|
-
return;
|
|
866
|
-
if (typeof to === "number") {
|
|
867
|
-
router.navigate(to);
|
|
868
|
-
} else {
|
|
869
|
-
router.navigate(to, _extends2({
|
|
870
|
-
fromRouteId: id
|
|
871
|
-
}, options));
|
|
872
|
-
}
|
|
873
|
-
}, [router, id]);
|
|
874
|
-
return navigate;
|
|
875
|
-
}
|
|
876
|
-
var START_TRANSITION = "startTransition";
|
|
877
|
-
var startTransitionImpl = React[START_TRANSITION];
|
|
878
|
-
function Router(_ref5) {
|
|
879
|
-
let {
|
|
880
|
-
basename: basenameProp = "/",
|
|
881
|
-
children = null,
|
|
882
|
-
location: locationProp,
|
|
883
|
-
navigationType = Action.Pop,
|
|
884
|
-
navigator,
|
|
885
|
-
static: staticProp = false
|
|
886
|
-
} = _ref5;
|
|
887
|
-
!!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : invariant(false) : void 0;
|
|
888
|
-
let basename = basenameProp.replace(/^\/*/, "/");
|
|
889
|
-
let navigationContext = React.useMemo(() => ({
|
|
890
|
-
basename,
|
|
891
|
-
navigator,
|
|
892
|
-
static: staticProp
|
|
893
|
-
}), [basename, navigator, staticProp]);
|
|
894
|
-
if (typeof locationProp === "string") {
|
|
895
|
-
locationProp = parsePath(locationProp);
|
|
896
|
-
}
|
|
897
|
-
let {
|
|
898
|
-
pathname = "/",
|
|
899
|
-
search = "",
|
|
900
|
-
hash = "",
|
|
901
|
-
state = null,
|
|
902
|
-
key = "default"
|
|
903
|
-
} = locationProp;
|
|
904
|
-
let locationContext = React.useMemo(() => {
|
|
905
|
-
let trailingPathname = stripBasename(pathname, basename);
|
|
906
|
-
if (trailingPathname == null) {
|
|
907
|
-
return null;
|
|
908
|
-
}
|
|
909
|
-
return {
|
|
910
|
-
location: {
|
|
911
|
-
pathname: trailingPathname,
|
|
912
|
-
search,
|
|
913
|
-
hash,
|
|
914
|
-
state,
|
|
915
|
-
key
|
|
916
|
-
},
|
|
917
|
-
navigationType
|
|
918
|
-
};
|
|
919
|
-
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
920
|
-
process.env.NODE_ENV !== "production" ? warning(locationContext != null, '<Router basename="' + basename + '"> is not able to match the URL ' + ('"' + pathname + search + hash + '" because it does not start with the ') + "basename, so the <Router> won't render anything.") : void 0;
|
|
921
|
-
if (locationContext == null) {
|
|
922
|
-
return null;
|
|
923
|
-
}
|
|
924
|
-
return /* @__PURE__ */ React.createElement(NavigationContext.Provider, {
|
|
925
|
-
value: navigationContext
|
|
926
|
-
}, /* @__PURE__ */ React.createElement(LocationContext.Provider, {
|
|
927
|
-
children,
|
|
928
|
-
value: locationContext
|
|
929
|
-
}));
|
|
930
|
-
}
|
|
931
|
-
var neverSettledPromise = new Promise(() => {
|
|
932
|
-
});
|
|
933
|
-
|
|
934
|
-
// ../../../node_modules/react-router-dom/dist/index.js
|
|
935
|
-
function _extends3() {
|
|
936
|
-
_extends3 = Object.assign ? Object.assign.bind() : function(target) {
|
|
937
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
938
|
-
var source = arguments[i];
|
|
939
|
-
for (var key in source) {
|
|
940
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
941
|
-
target[key] = source[key];
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
return target;
|
|
946
|
-
};
|
|
947
|
-
return _extends3.apply(this, arguments);
|
|
948
|
-
}
|
|
949
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
950
|
-
if (source == null)
|
|
951
|
-
return {};
|
|
952
|
-
var target = {};
|
|
953
|
-
var sourceKeys = Object.keys(source);
|
|
954
|
-
var key, i;
|
|
955
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
956
|
-
key = sourceKeys[i];
|
|
957
|
-
if (excluded.indexOf(key) >= 0)
|
|
958
|
-
continue;
|
|
959
|
-
target[key] = source[key];
|
|
960
|
-
}
|
|
961
|
-
return target;
|
|
962
|
-
}
|
|
963
|
-
var defaultMethod = "get";
|
|
964
|
-
var defaultEncType = "application/x-www-form-urlencoded";
|
|
965
|
-
function isHtmlElement(object) {
|
|
966
|
-
return object != null && typeof object.tagName === "string";
|
|
967
|
-
}
|
|
968
|
-
function isButtonElement(object) {
|
|
969
|
-
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
970
|
-
}
|
|
971
|
-
function isFormElement(object) {
|
|
972
|
-
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
973
|
-
}
|
|
974
|
-
function isInputElement(object) {
|
|
975
|
-
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
976
|
-
}
|
|
977
|
-
function isModifiedEvent(event) {
|
|
978
|
-
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
979
|
-
}
|
|
980
|
-
function shouldProcessLinkClick(event, target) {
|
|
981
|
-
return event.button === 0 && // Ignore everything but left clicks
|
|
982
|
-
(!target || target === "_self") && // Let browser handle "target=_blank" etc.
|
|
983
|
-
!isModifiedEvent(event);
|
|
984
|
-
}
|
|
985
|
-
var _formDataSupportsSubmitter = null;
|
|
986
|
-
function isFormDataSubmitterSupported() {
|
|
987
|
-
if (_formDataSupportsSubmitter === null) {
|
|
988
|
-
try {
|
|
989
|
-
new FormData(
|
|
990
|
-
document.createElement("form"),
|
|
991
|
-
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
992
|
-
0
|
|
993
|
-
);
|
|
994
|
-
_formDataSupportsSubmitter = false;
|
|
995
|
-
} catch (e) {
|
|
996
|
-
_formDataSupportsSubmitter = true;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
return _formDataSupportsSubmitter;
|
|
1000
|
-
}
|
|
1001
|
-
var supportedFormEncTypes = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
|
|
1002
|
-
function getFormEncType(encType) {
|
|
1003
|
-
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
1004
|
-
process.env.NODE_ENV !== "production" ? warning(false, '"' + encType + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + defaultEncType + '"')) : void 0;
|
|
1005
|
-
return null;
|
|
1006
|
-
}
|
|
1007
|
-
return encType;
|
|
1008
|
-
}
|
|
1009
|
-
function getFormSubmissionInfo(target, basename) {
|
|
1010
|
-
let method;
|
|
1011
|
-
let action;
|
|
1012
|
-
let encType;
|
|
1013
|
-
let formData;
|
|
1014
|
-
let body;
|
|
1015
|
-
if (isFormElement(target)) {
|
|
1016
|
-
let attr = target.getAttribute("action");
|
|
1017
|
-
action = attr ? stripBasename(attr, basename) : null;
|
|
1018
|
-
method = target.getAttribute("method") || defaultMethod;
|
|
1019
|
-
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
1020
|
-
formData = new FormData(target);
|
|
1021
|
-
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
1022
|
-
let form = target.form;
|
|
1023
|
-
if (form == null) {
|
|
1024
|
-
throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');
|
|
1025
|
-
}
|
|
1026
|
-
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
1027
|
-
action = attr ? stripBasename(attr, basename) : null;
|
|
1028
|
-
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
1029
|
-
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
1030
|
-
formData = new FormData(form, target);
|
|
1031
|
-
if (!isFormDataSubmitterSupported()) {
|
|
1032
|
-
let {
|
|
1033
|
-
name,
|
|
1034
|
-
type,
|
|
1035
|
-
value
|
|
1036
|
-
} = target;
|
|
1037
|
-
if (type === "image") {
|
|
1038
|
-
let prefix = name ? name + "." : "";
|
|
1039
|
-
formData.append(prefix + "x", "0");
|
|
1040
|
-
formData.append(prefix + "y", "0");
|
|
1041
|
-
} else if (name) {
|
|
1042
|
-
formData.append(name, value);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
} else if (isHtmlElement(target)) {
|
|
1046
|
-
throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');
|
|
1047
|
-
} else {
|
|
1048
|
-
method = defaultMethod;
|
|
1049
|
-
action = null;
|
|
1050
|
-
encType = defaultEncType;
|
|
1051
|
-
body = target;
|
|
1052
|
-
}
|
|
1053
|
-
if (formData && encType === "text/plain") {
|
|
1054
|
-
body = formData;
|
|
1055
|
-
formData = void 0;
|
|
1056
|
-
}
|
|
1057
|
-
return {
|
|
1058
|
-
action,
|
|
1059
|
-
method: method.toLowerCase(),
|
|
1060
|
-
encType,
|
|
1061
|
-
formData,
|
|
1062
|
-
body
|
|
1063
|
-
};
|
|
1064
|
-
}
|
|
1065
|
-
var _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset"];
|
|
1066
|
-
var _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "children"];
|
|
1067
|
-
var _excluded3 = ["reloadDocument", "replace", "state", "method", "action", "onSubmit", "submit", "relative", "preventScrollReset"];
|
|
1068
|
-
var START_TRANSITION2 = "startTransition";
|
|
1069
|
-
var startTransitionImpl2 = React2[START_TRANSITION2];
|
|
1070
|
-
function HistoryRouter(_ref3) {
|
|
1071
|
-
let {
|
|
1072
|
-
basename,
|
|
1073
|
-
children,
|
|
1074
|
-
future,
|
|
1075
|
-
history
|
|
1076
|
-
} = _ref3;
|
|
1077
|
-
let [state, setStateImpl] = React2.useState({
|
|
1078
|
-
action: history.action,
|
|
1079
|
-
location: history.location
|
|
1080
|
-
});
|
|
1081
|
-
let {
|
|
1082
|
-
v7_startTransition
|
|
1083
|
-
} = future || {};
|
|
1084
|
-
let setState = React2.useCallback((newState) => {
|
|
1085
|
-
v7_startTransition && startTransitionImpl2 ? startTransitionImpl2(() => setStateImpl(newState)) : setStateImpl(newState);
|
|
1086
|
-
}, [setStateImpl, v7_startTransition]);
|
|
1087
|
-
React2.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
1088
|
-
return /* @__PURE__ */ React2.createElement(Router, {
|
|
1089
|
-
basename,
|
|
1090
|
-
children,
|
|
1091
|
-
location: state.location,
|
|
1092
|
-
navigationType: state.action,
|
|
1093
|
-
navigator: history
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1097
|
-
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
1098
|
-
}
|
|
1099
|
-
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
1100
|
-
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1101
|
-
var Link = /* @__PURE__ */ React2.forwardRef(function LinkWithRef(_ref4, ref) {
|
|
1102
|
-
let {
|
|
1103
|
-
onClick,
|
|
1104
|
-
relative,
|
|
1105
|
-
reloadDocument,
|
|
1106
|
-
replace,
|
|
1107
|
-
state,
|
|
1108
|
-
target,
|
|
1109
|
-
to,
|
|
1110
|
-
preventScrollReset
|
|
1111
|
-
} = _ref4, rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
1112
|
-
let {
|
|
1113
|
-
basename
|
|
1114
|
-
} = React2.useContext(NavigationContext);
|
|
1115
|
-
let absoluteHref;
|
|
1116
|
-
let isExternal = false;
|
|
1117
|
-
if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
|
|
1118
|
-
absoluteHref = to;
|
|
1119
|
-
if (isBrowser) {
|
|
1120
|
-
try {
|
|
1121
|
-
let currentUrl = new URL(window.location.href);
|
|
1122
|
-
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
1123
|
-
let path = stripBasename(targetUrl.pathname, basename);
|
|
1124
|
-
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
1125
|
-
to = path + targetUrl.search + targetUrl.hash;
|
|
1126
|
-
} else {
|
|
1127
|
-
isExternal = true;
|
|
1128
|
-
}
|
|
1129
|
-
} catch (e) {
|
|
1130
|
-
process.env.NODE_ENV !== "production" ? warning(false, '<Link to="' + to + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.') : void 0;
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
let href = useHref(to, {
|
|
1135
|
-
relative
|
|
1136
|
-
});
|
|
1137
|
-
let internalOnClick = useLinkClickHandler(to, {
|
|
1138
|
-
replace,
|
|
1139
|
-
state,
|
|
1140
|
-
target,
|
|
1141
|
-
preventScrollReset,
|
|
1142
|
-
relative
|
|
1143
|
-
});
|
|
1144
|
-
function handleClick(event) {
|
|
1145
|
-
if (onClick)
|
|
1146
|
-
onClick(event);
|
|
1147
|
-
if (!event.defaultPrevented) {
|
|
1148
|
-
internalOnClick(event);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
return (
|
|
1152
|
-
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
1153
|
-
/* @__PURE__ */ React2.createElement("a", _extends3({}, rest, {
|
|
1154
|
-
href: absoluteHref || href,
|
|
1155
|
-
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
1156
|
-
ref,
|
|
1157
|
-
target
|
|
1158
|
-
}))
|
|
1159
|
-
);
|
|
1160
|
-
});
|
|
1161
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1162
|
-
Link.displayName = "Link";
|
|
1163
|
-
}
|
|
1164
|
-
var NavLink = /* @__PURE__ */ React2.forwardRef(function NavLinkWithRef(_ref5, ref) {
|
|
1165
|
-
let {
|
|
1166
|
-
"aria-current": ariaCurrentProp = "page",
|
|
1167
|
-
caseSensitive = false,
|
|
1168
|
-
className: classNameProp = "",
|
|
1169
|
-
end = false,
|
|
1170
|
-
style: styleProp,
|
|
1171
|
-
to,
|
|
1172
|
-
children
|
|
1173
|
-
} = _ref5, rest = _objectWithoutPropertiesLoose(_ref5, _excluded2);
|
|
1174
|
-
let path = useResolvedPath(to, {
|
|
1175
|
-
relative: rest.relative
|
|
1176
|
-
});
|
|
1177
|
-
let location = useLocation();
|
|
1178
|
-
let routerState = React2.useContext(DataRouterStateContext);
|
|
1179
|
-
let {
|
|
1180
|
-
navigator
|
|
1181
|
-
} = React2.useContext(NavigationContext);
|
|
1182
|
-
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
1183
|
-
let locationPathname = location.pathname;
|
|
1184
|
-
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
1185
|
-
if (!caseSensitive) {
|
|
1186
|
-
locationPathname = locationPathname.toLowerCase();
|
|
1187
|
-
nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
|
|
1188
|
-
toPathname = toPathname.toLowerCase();
|
|
1189
|
-
}
|
|
1190
|
-
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(toPathname.length) === "/";
|
|
1191
|
-
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
|
|
1192
|
-
let ariaCurrent = isActive ? ariaCurrentProp : void 0;
|
|
1193
|
-
let className;
|
|
1194
|
-
if (typeof classNameProp === "function") {
|
|
1195
|
-
className = classNameProp({
|
|
1196
|
-
isActive,
|
|
1197
|
-
isPending
|
|
1198
|
-
});
|
|
1199
|
-
} else {
|
|
1200
|
-
className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null].filter(Boolean).join(" ");
|
|
1201
|
-
}
|
|
1202
|
-
let style = typeof styleProp === "function" ? styleProp({
|
|
1203
|
-
isActive,
|
|
1204
|
-
isPending
|
|
1205
|
-
}) : styleProp;
|
|
1206
|
-
return /* @__PURE__ */ React2.createElement(Link, _extends3({}, rest, {
|
|
1207
|
-
"aria-current": ariaCurrent,
|
|
1208
|
-
className,
|
|
1209
|
-
ref,
|
|
1210
|
-
style,
|
|
1211
|
-
to
|
|
1212
|
-
}), typeof children === "function" ? children({
|
|
1213
|
-
isActive,
|
|
1214
|
-
isPending
|
|
1215
|
-
}) : children);
|
|
1216
|
-
});
|
|
1217
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1218
|
-
NavLink.displayName = "NavLink";
|
|
1219
|
-
}
|
|
1220
|
-
var Form = /* @__PURE__ */ React2.forwardRef((props, ref) => {
|
|
1221
|
-
let submit = useSubmit();
|
|
1222
|
-
return /* @__PURE__ */ React2.createElement(FormImpl, _extends3({}, props, {
|
|
1223
|
-
submit,
|
|
1224
|
-
ref
|
|
1225
|
-
}));
|
|
1226
|
-
});
|
|
1227
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1228
|
-
Form.displayName = "Form";
|
|
1229
|
-
}
|
|
1230
|
-
var FormImpl = /* @__PURE__ */ React2.forwardRef((_ref6, forwardedRef) => {
|
|
1231
|
-
let {
|
|
1232
|
-
reloadDocument,
|
|
1233
|
-
replace,
|
|
1234
|
-
state,
|
|
1235
|
-
method = defaultMethod,
|
|
1236
|
-
action,
|
|
1237
|
-
onSubmit,
|
|
1238
|
-
submit,
|
|
1239
|
-
relative,
|
|
1240
|
-
preventScrollReset
|
|
1241
|
-
} = _ref6, props = _objectWithoutPropertiesLoose(_ref6, _excluded3);
|
|
1242
|
-
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
1243
|
-
let formAction = useFormAction(action, {
|
|
1244
|
-
relative
|
|
1245
|
-
});
|
|
1246
|
-
let submitHandler = (event) => {
|
|
1247
|
-
onSubmit && onSubmit(event);
|
|
1248
|
-
if (event.defaultPrevented)
|
|
1249
|
-
return;
|
|
1250
|
-
event.preventDefault();
|
|
1251
|
-
let submitter = event.nativeEvent.submitter;
|
|
1252
|
-
let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
|
|
1253
|
-
submit(submitter || event.currentTarget, {
|
|
1254
|
-
method: submitMethod,
|
|
1255
|
-
replace,
|
|
1256
|
-
state,
|
|
1257
|
-
relative,
|
|
1258
|
-
preventScrollReset
|
|
1259
|
-
});
|
|
1260
|
-
};
|
|
1261
|
-
return /* @__PURE__ */ React2.createElement("form", _extends3({
|
|
1262
|
-
ref: forwardedRef,
|
|
1263
|
-
method: formMethod,
|
|
1264
|
-
action: formAction,
|
|
1265
|
-
onSubmit: reloadDocument ? onSubmit : submitHandler
|
|
1266
|
-
}, props));
|
|
1267
|
-
});
|
|
1268
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1269
|
-
FormImpl.displayName = "FormImpl";
|
|
1270
|
-
}
|
|
1271
|
-
function ScrollRestoration(_ref7) {
|
|
1272
|
-
let {
|
|
1273
|
-
getKey,
|
|
1274
|
-
storageKey
|
|
1275
|
-
} = _ref7;
|
|
1276
|
-
useScrollRestoration({
|
|
1277
|
-
getKey,
|
|
1278
|
-
storageKey
|
|
1279
|
-
});
|
|
1280
|
-
return null;
|
|
1281
|
-
}
|
|
1282
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1283
|
-
ScrollRestoration.displayName = "ScrollRestoration";
|
|
1284
|
-
}
|
|
1285
|
-
var DataRouterHook2;
|
|
1286
|
-
(function(DataRouterHook3) {
|
|
1287
|
-
DataRouterHook3["UseScrollRestoration"] = "useScrollRestoration";
|
|
1288
|
-
DataRouterHook3["UseSubmit"] = "useSubmit";
|
|
1289
|
-
DataRouterHook3["UseSubmitFetcher"] = "useSubmitFetcher";
|
|
1290
|
-
DataRouterHook3["UseFetcher"] = "useFetcher";
|
|
1291
|
-
})(DataRouterHook2 || (DataRouterHook2 = {}));
|
|
1292
|
-
var DataRouterStateHook2;
|
|
1293
|
-
(function(DataRouterStateHook3) {
|
|
1294
|
-
DataRouterStateHook3["UseFetchers"] = "useFetchers";
|
|
1295
|
-
DataRouterStateHook3["UseScrollRestoration"] = "useScrollRestoration";
|
|
1296
|
-
})(DataRouterStateHook2 || (DataRouterStateHook2 = {}));
|
|
1297
|
-
function getDataRouterConsoleError2(hookName) {
|
|
1298
|
-
return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
|
1299
|
-
}
|
|
1300
|
-
function useDataRouterContext2(hookName) {
|
|
1301
|
-
let ctx = React2.useContext(DataRouterContext);
|
|
1302
|
-
!ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0;
|
|
1303
|
-
return ctx;
|
|
1304
|
-
}
|
|
1305
|
-
function useDataRouterState2(hookName) {
|
|
1306
|
-
let state = React2.useContext(DataRouterStateContext);
|
|
1307
|
-
!state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0;
|
|
1308
|
-
return state;
|
|
1309
|
-
}
|
|
1310
|
-
function useLinkClickHandler(to, _temp) {
|
|
1311
|
-
let {
|
|
1312
|
-
target,
|
|
1313
|
-
replace: replaceProp,
|
|
1314
|
-
state,
|
|
1315
|
-
preventScrollReset,
|
|
1316
|
-
relative
|
|
1317
|
-
} = _temp === void 0 ? {} : _temp;
|
|
1318
|
-
let navigate = useNavigate();
|
|
1319
|
-
let location = useLocation();
|
|
1320
|
-
let path = useResolvedPath(to, {
|
|
1321
|
-
relative
|
|
1322
|
-
});
|
|
1323
|
-
return React2.useCallback((event) => {
|
|
1324
|
-
if (shouldProcessLinkClick(event, target)) {
|
|
1325
|
-
event.preventDefault();
|
|
1326
|
-
let replace = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
1327
|
-
navigate(to, {
|
|
1328
|
-
replace,
|
|
1329
|
-
state,
|
|
1330
|
-
preventScrollReset,
|
|
1331
|
-
relative
|
|
1332
|
-
});
|
|
1333
|
-
}
|
|
1334
|
-
}, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative]);
|
|
1335
|
-
}
|
|
1336
|
-
function validateClientSideSubmission() {
|
|
1337
|
-
if (typeof document === "undefined") {
|
|
1338
|
-
throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
function useSubmit() {
|
|
1342
|
-
let {
|
|
1343
|
-
router
|
|
1344
|
-
} = useDataRouterContext2(DataRouterHook2.UseSubmit);
|
|
1345
|
-
let {
|
|
1346
|
-
basename
|
|
1347
|
-
} = React2.useContext(NavigationContext);
|
|
1348
|
-
let currentRouteId = useRouteId();
|
|
1349
|
-
return React2.useCallback(function(target, options) {
|
|
1350
|
-
if (options === void 0) {
|
|
1351
|
-
options = {};
|
|
1352
|
-
}
|
|
1353
|
-
validateClientSideSubmission();
|
|
1354
|
-
let {
|
|
1355
|
-
action,
|
|
1356
|
-
method,
|
|
1357
|
-
encType,
|
|
1358
|
-
formData,
|
|
1359
|
-
body
|
|
1360
|
-
} = getFormSubmissionInfo(target, basename);
|
|
1361
|
-
router.navigate(options.action || action, {
|
|
1362
|
-
preventScrollReset: options.preventScrollReset,
|
|
1363
|
-
formData,
|
|
1364
|
-
body,
|
|
1365
|
-
formMethod: options.method || method,
|
|
1366
|
-
formEncType: options.encType || encType,
|
|
1367
|
-
replace: options.replace,
|
|
1368
|
-
state: options.state,
|
|
1369
|
-
fromRouteId: currentRouteId
|
|
1370
|
-
});
|
|
1371
|
-
}, [router, basename, currentRouteId]);
|
|
1372
|
-
}
|
|
1373
|
-
function useFormAction(action, _temp2) {
|
|
1374
|
-
let {
|
|
1375
|
-
relative
|
|
1376
|
-
} = _temp2 === void 0 ? {} : _temp2;
|
|
1377
|
-
let {
|
|
1378
|
-
basename
|
|
1379
|
-
} = React2.useContext(NavigationContext);
|
|
1380
|
-
let routeContext = React2.useContext(RouteContext);
|
|
1381
|
-
!routeContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFormAction must be used inside a RouteContext") : invariant(false) : void 0;
|
|
1382
|
-
let [match] = routeContext.matches.slice(-1);
|
|
1383
|
-
let path = _extends3({}, useResolvedPath(action ? action : ".", {
|
|
1384
|
-
relative
|
|
1385
|
-
}));
|
|
1386
|
-
let location = useLocation();
|
|
1387
|
-
if (action == null) {
|
|
1388
|
-
path.search = location.search;
|
|
1389
|
-
if (match.route.index) {
|
|
1390
|
-
let params = new URLSearchParams(path.search);
|
|
1391
|
-
params.delete("index");
|
|
1392
|
-
path.search = params.toString() ? "?" + params.toString() : "";
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
if ((!action || action === ".") && match.route.index) {
|
|
1396
|
-
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
1397
|
-
}
|
|
1398
|
-
if (basename !== "/") {
|
|
1399
|
-
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
1400
|
-
}
|
|
1401
|
-
return createPath(path);
|
|
1402
|
-
}
|
|
1403
|
-
var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
|
|
1404
|
-
var savedScrollPositions = {};
|
|
1405
|
-
function useScrollRestoration(_temp3) {
|
|
1406
|
-
let {
|
|
1407
|
-
getKey,
|
|
1408
|
-
storageKey
|
|
1409
|
-
} = _temp3 === void 0 ? {} : _temp3;
|
|
1410
|
-
let {
|
|
1411
|
-
router
|
|
1412
|
-
} = useDataRouterContext2(DataRouterHook2.UseScrollRestoration);
|
|
1413
|
-
let {
|
|
1414
|
-
restoreScrollPosition,
|
|
1415
|
-
preventScrollReset
|
|
1416
|
-
} = useDataRouterState2(DataRouterStateHook2.UseScrollRestoration);
|
|
1417
|
-
let {
|
|
1418
|
-
basename
|
|
1419
|
-
} = React2.useContext(NavigationContext);
|
|
1420
|
-
let location = useLocation();
|
|
1421
|
-
let matches = useMatches();
|
|
1422
|
-
let navigation = useNavigation();
|
|
1423
|
-
React2.useEffect(() => {
|
|
1424
|
-
window.history.scrollRestoration = "manual";
|
|
1425
|
-
return () => {
|
|
1426
|
-
window.history.scrollRestoration = "auto";
|
|
1427
|
-
};
|
|
1428
|
-
}, []);
|
|
1429
|
-
usePageHide(React2.useCallback(() => {
|
|
1430
|
-
if (navigation.state === "idle") {
|
|
1431
|
-
let key = (getKey ? getKey(location, matches) : null) || location.key;
|
|
1432
|
-
savedScrollPositions[key] = window.scrollY;
|
|
1433
|
-
}
|
|
1434
|
-
sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
|
|
1435
|
-
window.history.scrollRestoration = "auto";
|
|
1436
|
-
}, [storageKey, getKey, navigation.state, location, matches]));
|
|
1437
|
-
if (typeof document !== "undefined") {
|
|
1438
|
-
React2.useLayoutEffect(() => {
|
|
1439
|
-
try {
|
|
1440
|
-
let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
|
|
1441
|
-
if (sessionPositions) {
|
|
1442
|
-
savedScrollPositions = JSON.parse(sessionPositions);
|
|
1443
|
-
}
|
|
1444
|
-
} catch (e) {
|
|
1445
|
-
}
|
|
1446
|
-
}, [storageKey]);
|
|
1447
|
-
React2.useLayoutEffect(() => {
|
|
1448
|
-
let getKeyWithoutBasename = getKey && basename !== "/" ? (location2, matches2) => getKey(
|
|
1449
|
-
// Strip the basename to match useLocation()
|
|
1450
|
-
_extends3({}, location2, {
|
|
1451
|
-
pathname: stripBasename(location2.pathname, basename) || location2.pathname
|
|
1452
|
-
}),
|
|
1453
|
-
matches2
|
|
1454
|
-
) : getKey;
|
|
1455
|
-
let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);
|
|
1456
|
-
return () => disableScrollRestoration && disableScrollRestoration();
|
|
1457
|
-
}, [router, basename, getKey]);
|
|
1458
|
-
React2.useLayoutEffect(() => {
|
|
1459
|
-
if (restoreScrollPosition === false) {
|
|
1460
|
-
return;
|
|
1461
|
-
}
|
|
1462
|
-
if (typeof restoreScrollPosition === "number") {
|
|
1463
|
-
window.scrollTo(0, restoreScrollPosition);
|
|
1464
|
-
return;
|
|
1465
|
-
}
|
|
1466
|
-
if (location.hash) {
|
|
1467
|
-
let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
|
|
1468
|
-
if (el) {
|
|
1469
|
-
el.scrollIntoView();
|
|
1470
|
-
return;
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
if (preventScrollReset === true) {
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1476
|
-
window.scrollTo(0, 0);
|
|
1477
|
-
}, [location, restoreScrollPosition, preventScrollReset]);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
function usePageHide(callback, options) {
|
|
1481
|
-
let {
|
|
1482
|
-
capture
|
|
1483
|
-
} = options || {};
|
|
1484
|
-
React2.useEffect(() => {
|
|
1485
|
-
let opts = capture != null ? {
|
|
1486
|
-
capture
|
|
1487
|
-
} : void 0;
|
|
1488
|
-
window.addEventListener("pagehide", callback, opts);
|
|
1489
|
-
return () => {
|
|
1490
|
-
window.removeEventListener("pagehide", callback, opts);
|
|
1491
|
-
};
|
|
1492
|
-
}, [callback, capture]);
|
|
1493
|
-
}
|
|
445
|
+
import { Link as Link3 } from "react-router-dom";
|
|
1494
446
|
|
|
1495
447
|
// src/styled-components/breadcrumb.ts
|
|
1496
448
|
import styled from "styled-components";
|
|
@@ -1531,6 +483,7 @@ var TitlePage = styled.div`
|
|
|
1531
483
|
`;
|
|
1532
484
|
|
|
1533
485
|
// src/styled-components/menu.ts
|
|
486
|
+
import { Link } from "react-router-dom";
|
|
1534
487
|
import styled2 from "styled-components";
|
|
1535
488
|
var MenuItem = styled2(Link)`
|
|
1536
489
|
text-decoration: none;
|
|
@@ -1650,6 +603,7 @@ var MenuOptions = styled4.div`
|
|
|
1650
603
|
`;
|
|
1651
604
|
|
|
1652
605
|
// src/styled-components/sidebar.ts
|
|
606
|
+
import { Link as Link2 } from "react-router-dom";
|
|
1653
607
|
import styled5 from "styled-components";
|
|
1654
608
|
var ItemSidebar = styled5.div`
|
|
1655
609
|
padding: 10px 25px;
|
|
@@ -1852,7 +806,7 @@ var ConfigurationOption = styled5.nav`
|
|
|
1852
806
|
transition: width 0.2s ease-in-out;
|
|
1853
807
|
overflow: hidden !important;
|
|
1854
808
|
`;
|
|
1855
|
-
var ItemLinkSidebar = styled5(
|
|
809
|
+
var ItemLinkSidebar = styled5(Link2)`
|
|
1856
810
|
padding: 10px 25px;
|
|
1857
811
|
display: flex;
|
|
1858
812
|
align-items: center;
|
|
@@ -1912,37 +866,39 @@ var CloseIcon = styled6.button`
|
|
|
1912
866
|
// src/layout/AppBreadcrumb.tsx
|
|
1913
867
|
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1914
868
|
var AppBreadCrumb = ({ title, paths }) => {
|
|
1915
|
-
const { setRoutes } =
|
|
1916
|
-
|
|
869
|
+
const { setRoutes } = useContext2(BreadCrumbContext);
|
|
870
|
+
useEffect7(() => {
|
|
1917
871
|
if (!(paths == null ? void 0 : paths.length))
|
|
1918
872
|
return;
|
|
1919
873
|
setRoutes(paths != null ? paths : []);
|
|
1920
874
|
}, []);
|
|
1921
875
|
return /* @__PURE__ */ jsx10(BreadCrumbTitle, { children: title != null ? title : "Home" });
|
|
1922
876
|
};
|
|
1923
|
-
var AppBreadCrumbNav = ({
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
877
|
+
var AppBreadCrumbNav = ({
|
|
878
|
+
paths,
|
|
879
|
+
onPush
|
|
880
|
+
}) => {
|
|
881
|
+
const { active, path, routes, setRoutes } = useContext2(BreadCrumbContext);
|
|
882
|
+
const { updateList } = useContext2(HistoryContext);
|
|
883
|
+
useEffect7(() => {
|
|
1928
884
|
updateList({ name: active, path });
|
|
1929
885
|
}, [path, active]);
|
|
1930
|
-
|
|
886
|
+
useEffect7(() => {
|
|
1931
887
|
setRoutes(paths != null ? paths : []);
|
|
1932
888
|
}, [paths]);
|
|
1933
889
|
return /* @__PURE__ */ jsxs4(Breadcrumb, { children: [
|
|
1934
890
|
/* @__PURE__ */ jsxs4("div", { className: "d-flex align-items-center", children: [
|
|
1935
|
-
/* @__PURE__ */ jsx10(
|
|
891
|
+
/* @__PURE__ */ jsx10(Link3, { to: "/", className: "link", children: "HOME" }),
|
|
1936
892
|
routes.length > 0 && /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" }),
|
|
1937
893
|
routes.length > 0 ? routes.map((i, idx, arr) => {
|
|
1938
894
|
if (i.route === -1) {
|
|
1939
|
-
return /* @__PURE__ */ jsxs4("span", { className: "link", onClick: () =>
|
|
895
|
+
return /* @__PURE__ */ jsxs4("span", { className: "link", onClick: () => onPush(-1), children: [
|
|
1940
896
|
i.title,
|
|
1941
897
|
" ",
|
|
1942
898
|
idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" })
|
|
1943
899
|
] }, idx);
|
|
1944
900
|
}
|
|
1945
|
-
return /* @__PURE__ */ jsxs4(
|
|
901
|
+
return /* @__PURE__ */ jsxs4(Link3, { to: i.route, className: "link", children: [
|
|
1946
902
|
i.title,
|
|
1947
903
|
" ",
|
|
1948
904
|
idx + 1 === arr.length ? "" : /* @__PURE__ */ jsx10(VscChevronRight, { color: "black" })
|
|
@@ -1954,11 +910,11 @@ var AppBreadCrumbNav = ({ paths }) => {
|
|
|
1954
910
|
{
|
|
1955
911
|
onClick: () => {
|
|
1956
912
|
if ((routes == null ? void 0 : routes.length) === 1) {
|
|
1957
|
-
|
|
913
|
+
onPush("/");
|
|
1958
914
|
setRoutes([]);
|
|
1959
915
|
return;
|
|
1960
916
|
}
|
|
1961
|
-
|
|
917
|
+
onPush(`${routes && routes[(routes == null ? void 0 : routes.length) - 2].route}`);
|
|
1962
918
|
},
|
|
1963
919
|
children: /* @__PURE__ */ jsx10(MdClose, { fontSize: 20 })
|
|
1964
920
|
}
|
|
@@ -1967,7 +923,7 @@ var AppBreadCrumbNav = ({ paths }) => {
|
|
|
1967
923
|
};
|
|
1968
924
|
|
|
1969
925
|
// src/layout/AppLoader.tsx
|
|
1970
|
-
import { useEffect as
|
|
926
|
+
import { useEffect as useEffect8 } from "react";
|
|
1971
927
|
import ReactDOM from "react-dom";
|
|
1972
928
|
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1973
929
|
var LoaderGrid = () => {
|
|
@@ -1988,7 +944,7 @@ var AppLoader = (props) => {
|
|
|
1988
944
|
/* @__PURE__ */ jsx11("div", { className: "k-loading-image" }),
|
|
1989
945
|
/* @__PURE__ */ jsx11("div", { className: "k-loading-color" })
|
|
1990
946
|
] });
|
|
1991
|
-
|
|
947
|
+
useEffect8(() => {
|
|
1992
948
|
if (type === "button") {
|
|
1993
949
|
const loadingEl = document.createElement("div");
|
|
1994
950
|
loadingEl.className = "icon button-loading k-loading-mask";
|
|
@@ -2146,41 +1102,3 @@ export {
|
|
|
2146
1102
|
usePrevious,
|
|
2147
1103
|
useStep
|
|
2148
1104
|
};
|
|
2149
|
-
/*! Bundled license information:
|
|
2150
|
-
|
|
2151
|
-
@remix-run/router/dist/router.js:
|
|
2152
|
-
(**
|
|
2153
|
-
* @remix-run/router v1.9.0
|
|
2154
|
-
*
|
|
2155
|
-
* Copyright (c) Remix Software Inc.
|
|
2156
|
-
*
|
|
2157
|
-
* This source code is licensed under the MIT license found in the
|
|
2158
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
2159
|
-
*
|
|
2160
|
-
* @license MIT
|
|
2161
|
-
*)
|
|
2162
|
-
|
|
2163
|
-
react-router/dist/index.js:
|
|
2164
|
-
(**
|
|
2165
|
-
* React Router v6.16.0
|
|
2166
|
-
*
|
|
2167
|
-
* Copyright (c) Remix Software Inc.
|
|
2168
|
-
*
|
|
2169
|
-
* This source code is licensed under the MIT license found in the
|
|
2170
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
2171
|
-
*
|
|
2172
|
-
* @license MIT
|
|
2173
|
-
*)
|
|
2174
|
-
|
|
2175
|
-
react-router-dom/dist/index.js:
|
|
2176
|
-
(**
|
|
2177
|
-
* React Router DOM v6.16.0
|
|
2178
|
-
*
|
|
2179
|
-
* Copyright (c) Remix Software Inc.
|
|
2180
|
-
*
|
|
2181
|
-
* This source code is licensed under the MIT license found in the
|
|
2182
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
2183
|
-
*
|
|
2184
|
-
* @license MIT
|
|
2185
|
-
*)
|
|
2186
|
-
*/
|