@starasia/admin 14.0.4 → 15.0.0
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/adapters/tanstack.cjs.js +1 -1
- package/dist/adapters/tanstack.es.js +45 -30
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +15 -3
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("@tanstack/react-router"),g=e=>{if(e!=null)return typeof e=="string"?e:JSON.stringify(e)},P=e=>{if(e==="")return e;try{const t=JSON.parse(e);if(t===null)return e;if(JSON.stringify(t)===e)return t}catch{}return e},d={useLocation:()=>{const e=a.useLocation();return{pathname:e.pathname,search:e.searchStr??"",hash:e.hash??"",state:e.state}},useParams:()=>a.useParams({strict:!1}),useSearchParams:()=>{const e=a.useNavigate(),t=a.useLocation(),r=t.searchStr??"",m=t.search,o=u.useMemo(()=>{const s=new URLSearchParams;return Object.entries(m??{}).forEach(([n,c])=>{const i=g(c);i!==void 0&&s.set(n,i)}),s},[r]),h=u.useCallback((s,n)=>{const c=typeof s=="function"?s(new URLSearchParams(o)):s,i=c instanceof URLSearchParams?c:new URLSearchParams(c),f={};i.forEach((l,S)=>{f[S]=P(l)}),e({to:".",search:f,replace:n==null?void 0:n.replace})},[e,o]);return u.useMemo(()=>[o,h],[o,h])},useNavigate:()=>{const e=a.useNavigate();return(t,r)=>{if(typeof t=="number"){window.history.go(t);return}e({to:t,replace:r==null?void 0:r.replace})}},Link:({to:e,children:t,...r})=>u.createElement(a.Link,{to:e,...r},t),Outlet:a.Outlet};exports.tanstackAdapter=d;
|
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Outlet as
|
|
3
|
-
const
|
|
1
|
+
import g, { useMemo as h, useCallback as p } from "react";
|
|
2
|
+
import { Outlet as L, Link as y, useNavigate as f, useLocation as m, useParams as O } from "@tanstack/react-router";
|
|
3
|
+
const d = (e) => {
|
|
4
|
+
if (e != null)
|
|
5
|
+
return typeof e == "string" ? e : JSON.stringify(e);
|
|
6
|
+
}, R = (e) => {
|
|
7
|
+
if (e === "") return e;
|
|
8
|
+
try {
|
|
9
|
+
const r = JSON.parse(e);
|
|
10
|
+
if (r === null) return e;
|
|
11
|
+
if (JSON.stringify(r) === e) return r;
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
return e;
|
|
15
|
+
}, k = {
|
|
4
16
|
useLocation: () => {
|
|
5
|
-
const
|
|
17
|
+
const e = m();
|
|
6
18
|
return {
|
|
7
|
-
pathname:
|
|
8
|
-
search:
|
|
9
|
-
hash:
|
|
10
|
-
state:
|
|
19
|
+
pathname: e.pathname,
|
|
20
|
+
search: e.searchStr ?? "",
|
|
21
|
+
hash: e.hash ?? "",
|
|
22
|
+
state: e.state
|
|
11
23
|
};
|
|
12
24
|
},
|
|
13
|
-
useParams: () =>
|
|
25
|
+
useParams: () => O({ strict: !1 }),
|
|
14
26
|
useSearchParams: () => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
[
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
const e = f(), r = m(), t = r.searchStr ?? "", S = r.search, c = h(() => {
|
|
28
|
+
const a = new URLSearchParams();
|
|
29
|
+
return Object.entries(S ?? {}).forEach(([n, s]) => {
|
|
30
|
+
const o = d(s);
|
|
31
|
+
o !== void 0 && a.set(n, o);
|
|
32
|
+
}), a;
|
|
33
|
+
}, [t]), i = p(
|
|
34
|
+
(a, n) => {
|
|
35
|
+
const s = typeof a == "function" ? a(new URLSearchParams(c)) : a, o = s instanceof URLSearchParams ? s : new URLSearchParams(s), u = {};
|
|
36
|
+
o.forEach((l, P) => {
|
|
37
|
+
u[P] = R(l);
|
|
38
|
+
}), e({
|
|
24
39
|
to: ".",
|
|
25
|
-
search:
|
|
26
|
-
replace:
|
|
40
|
+
search: u,
|
|
41
|
+
replace: n == null ? void 0 : n.replace
|
|
27
42
|
});
|
|
28
43
|
},
|
|
29
|
-
[
|
|
44
|
+
[e, c]
|
|
30
45
|
);
|
|
31
|
-
return
|
|
32
|
-
() => [
|
|
33
|
-
[
|
|
46
|
+
return h(
|
|
47
|
+
() => [c, i],
|
|
48
|
+
[c, i]
|
|
34
49
|
);
|
|
35
50
|
},
|
|
36
51
|
useNavigate: () => {
|
|
37
|
-
const
|
|
38
|
-
return (r,
|
|
52
|
+
const e = f();
|
|
53
|
+
return (r, t) => {
|
|
39
54
|
if (typeof r == "number") {
|
|
40
55
|
window.history.go(r);
|
|
41
56
|
return;
|
|
42
57
|
}
|
|
43
|
-
|
|
58
|
+
e({ to: r, replace: t == null ? void 0 : t.replace });
|
|
44
59
|
};
|
|
45
60
|
},
|
|
46
|
-
Link: ({ to:
|
|
47
|
-
Outlet:
|
|
61
|
+
Link: ({ to: e, children: r, ...t }) => g.createElement(y, { to: e, ...t }, r),
|
|
62
|
+
Outlet: L
|
|
48
63
|
};
|
|
49
64
|
export {
|
|
50
|
-
|
|
65
|
+
k as tanstackAdapter
|
|
51
66
|
};
|