mtxuilib 0.0.399 → 0.0.401

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.
@@ -1 +1 @@
1
- "use client";import{Fragment as t,jsx as e,jsxs as r}from"react/jsx-runtime";import{MtLink as a}from"../common/mtlink";import{PageSearchCmd as s}from"./PageSearchCmd";const d=()=>e(t,{children:e("header",{className:"bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50 w-full border-b backdrop-blur",children:r("div",{className:"flex h-14 items-center",children:[e("div",{className:"hidden w-52 items-center justify-center md:flex",children:e(a,{href:"/",className:"flex items-center space-x-2"})}),e("nav",{className:" flex items-center space-x-6 text-sm font-medium"}),e("div",{children:e(s,{})}),e("div",{className:"flex flex-1 shrink items-center justify-end space-x-2 pr-4",children:e("nav",{className:"flex items-center"})})]})})});export{d as DefaultHeader};
1
+ "use client";import{Fragment as m,jsx as e,jsxs as i}from"react/jsx-runtime";import{MtLink as a}from"../common/mtlink";import{PageSearchCmd as r}from"./PageSearchCmd";import s from"./UserAvatorMenus";import{MainNav as t}from"./main-nav";const o=()=>e(m,{children:e("header",{className:"bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 w-full border-b backdrop-blur",children:i("div",{className:"flex h-14 items-center",children:[e("div",{className:"hidden w-52 items-center justify-center md:flex",children:e(a,{href:"/",className:"flex items-center space-x-2"})}),e(t,{}),e("nav",{className:" flex items-center space-x-6 text-sm font-medium"}),e("div",{children:e(r,{})}),e("div",{className:"flex flex-1 shrink items-center justify-end space-x-2 pr-4",children:e("nav",{className:"flex items-center",children:e(s,{})})})]})})});export{o as DefaultHeader};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare function MainNav(): import("react").JSX.Element | null;
3
+ export declare function MainNavOld(): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";var h=Object.defineProperty,b=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var i=Object.getOwnPropertySymbols;var m=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var l=(e,t,s)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,p=(e,t)=>{for(var s in t||(t={}))m.call(t,s)&&l(e,s,t[s]);if(i)for(var s of i(t))c.call(t,s)&&l(e,s,t[s]);return e},f=(e,t)=>b(e,k(t));var d=(e,t)=>{var s={};for(var a in e)m.call(e,a)&&t.indexOf(a)<0&&(s[a]=e[a]);if(e!=null&&i)for(var a of i(e))t.indexOf(a)<0&&c.call(e,a)&&(s[a]=e[a]);return s};import{Fragment as H,jsx as o,jsxs as r}from"react/jsx-runtime";import{DotsHorizontalIcon as x}from"@radix-ui/react-icons";import{useSuspenseQuery as M}from"gomtm/connectquery";import{blogCategorieList as L}from"gomtm/gomtmpb/mtm/sppb/mtm-MtmService_connectquery";import u from"next/link";import{useRouter as S}from"next/navigation";import{useState as y}from"react";import{MtLink as C}from"../common/mtlink";import{Icons as v}from"../icons/icons";import{cn as P}from"../lib/utils";import{buttonVariants as R}from"../ui/button";import{ScrollArea as T}from"../ui/scroll-area";import{Sheet as w,SheetContent as z,SheetTrigger as A}from"../ui/sheet";import{MtButton as B}from"../ui/ui-mt/Button";function j(){var t;const e=M(L,{limit:6});return e.data?r(H,{children:[o("div",{className:"flex gap-2 pl-2 md:gap-2",children:o("div",{className:"pr-1",children:o("nav",{className:"hidden gap-1 md:flex",children:(t=e.data.items)==null?void 0:t.map((s,a)=>a>6?null:o(u,{href:"/cat/"+s.id,className:R({variant:"ghost"}),children:s.title},a))})})}),o(I,{})]}):null}function I(){const[e,t]=y(!1);return r(w,{open:e,onOpenChange:t,children:[o(A,{asChild:!0,children:r(B,{variant:"ghost",className:"mr-2 px-0 text-base hover:bg-transparent focus-visible:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 md:hidden",children:[o(x,{className:"h-5 w-5"}),o("span",{className:"sr-only",children:"Toggle Menu"})]})}),r(z,{side:"left",className:"pr-0",children:[o(D,{href:"/",className:"flex items-center",onOpenChange:t,children:o(v.logo,{className:"mr-2 h-4 w-4"})}),o(T,{className:"my-4 h-[calc(100vh-8rem)] pb-10 pl-2",children:o("div",{className:"flex flex-col space-y-2"})})]})]})}function D(O){var n=O,{href:e,onOpenChange:t,className:s,children:a}=n,N=d(n,["href","onOpenChange","className","children"]);const g=S();return o(u,f(p({href:e,onClick:()=>{g.push(e.toString()),t==null||t(!1)},className:P(s)},N),{children:a}))}function ee(){return r("div",{className:"mr-4 hidden md:flex",children:[r(C,{href:"/",className:"mr-6 flex items-center space-x-2",children:[o(v.logo,{className:"size-6"}),o("span",{className:"hidden font-bold sm:inline-block"})]}),o("nav",{className:" flex items-center space-x-6 text-sm font-medium"})]})}export{j as MainNav,ee as MainNavOld};
@@ -1 +1 @@
1
- "use client";import{Fragment as k,jsx as e,jsxs as f}from"react/jsx-runtime";import{useSuspenseInfiniteQuery as p}from"gomtm/connectquery";import{ListViewLayout as m}from"gomtm/gomtmpb/mtm/sppb/mtm_pb";import{atom as y,useAtom as g}from"jotai";import{useHydrateAtoms as c}from"jotai/utils";import{ListItemView as P}from"../components/ListItem";import{MtUnaryCallErrorView as L}from"../components/MtUnaryCallErrorView";import{cn as h}from"../lib/utils";import{Pagination as I,PaginationContent as v,PaginationEllipsis as w,PaginationItem as n,PaginationLink as u,PaginationNext as x,PaginationPrevious as C}from"../ui/pagination";const l=y(null);function K(t){const{children:i,methodList:r}=t,o=p(r,{page:1},{pageParamKey:"pagination",getNextPageParam:(s,d,a)=>({page:((a==null?void 0:a.page)||0)+1})});return c([[l,o]]),e(k,{children:i})}function _(){const[t,i]=g(l);return t!=null&&t.data?f("div",{className:"relative w-full",children:[e("div",{className:h("w-full"),children:t.data.pages.map((r,o)=>{var s;return r.error_code?e(L,{unaryError:r},o):e(M,{layout:r.listLayout,children:(s=r==null?void 0:r.items)==null?void 0:s.map((d,a)=>e(P,{item:d},`${o}-${a}`))},o)})}),e(I,{children:f(v,{children:[e(n,{children:e(C,{href:"#"})}),e(n,{children:e(u,{href:"#",children:"1"})}),e(n,{children:e(u,{href:"#",isActive:!0,children:"2"})}),e(n,{children:e(u,{href:"#",children:"3"})}),e(n,{children:e(w,{})}),e(n,{children:e(x,{href:"#"})})]})}),e("div",{className:"absolute right-1 top-1"})]}):null}const M=t=>{const{children:i}=t;switch(t.layout){case m.simple:return e("div",{className:"flex flex-col space-y-1 rounded-md p-2 shadow-sm",children:i});case m.grid:return e("div",{className:"grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3",children:i});case m.card:return e("div",{className:"grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3",children:i});default:return i}};function z(){const[t,i]=g(l);return{listQuery:t}}export{_ as CommonListView,K as CommonListViewProvider,z as useCommonListView};
1
+ "use client";import{Fragment as k,jsx as e,jsxs as p}from"react/jsx-runtime";import{useSuspenseInfiniteQuery as y}from"gomtm/connectquery";import{ListViewLayout as m}from"gomtm/gomtmpb/mtm/sppb/mtm_pb";import{atom as f,useAtom as g}from"jotai";import{useHydrateAtoms as c}from"jotai/utils";import{ListItemView as P}from"../components/ListItem";import{MtUnaryCallErrorView as L}from"../components/MtUnaryCallErrorView";import{cn as h}from"../lib/utils";import{Pagination as I,PaginationContent as v,PaginationEllipsis as w,PaginationItem as r,PaginationLink as u,PaginationNext as x,PaginationPrevious as C}from"../ui/pagination";const l=f(null);function K(t){const{children:i,methodList:n}=t,o=y(n,{page:1},{pageParamKey:"pagination",getNextPageParam:(s,d,a)=>({page:((a==null?void 0:a.page)||0)+1})});return c([[l,o]]),e(k,{children:i})}function _(){const[t,i]=g(l);return t!=null&&t.data?p("div",{className:"relative w-full",children:[e("div",{className:h("w-full"),children:t.data.pages.map((n,o)=>{var s;return n.error_code?e(L,{unaryError:n},o):e(M,{layout:n.listLayout,children:(s=n==null?void 0:n.items)==null?void 0:s.map((d,a)=>e(P,{item:d},`${o}-${a}`))},o)})}),e(I,{children:p(v,{children:[e(r,{children:e(C,{href:"#"})}),e(r,{children:e(u,{href:"#",children:"1"})}),e(r,{children:e(u,{href:"#",isActive:!0,children:"2"})}),e(r,{children:e(u,{href:"#",children:"3"})}),e(r,{children:e(w,{})}),e(r,{children:e(x,{href:"#"})})]})}),e("div",{className:"absolute right-1 top-1"})]}):null}const M=t=>{const{children:i}=t;switch(t.layout){case m.simple:return e("div",{className:"flex flex-col space-y-1 rounded-md p-2 shadow-sm",children:i});case m.grid:return e("div",{className:"grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3",children:i});case m.card:return e("div",{className:"grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3",children:i});default:return i}};function z(){const[t,i]=g(l);return{listQuery:t}}export{_ as CommonListView,K as CommonListViewProvider,z as useCommonListView};
@@ -1,6 +1,6 @@
1
1
  import { PlainMessage } from "gomtm";
2
2
  import { MtUnaryCallError } from "gomtm/connectquery/utils";
3
- import { CommentListRes, CurdView } from "gomtm/gomtmpb/mtm/sppb/mtm_pb";
3
+ import { CommontListRes, CurdView } from "gomtm/gomtmpb/mtm/sppb/mtm_pb";
4
4
  import { PropsWithChildren } from "react";
5
5
  export declare const activateIdAtom: import("jotai").PrimitiveAtom<string> & {
6
6
  init: string;
@@ -75,7 +75,7 @@ export declare function useCurdView(): {
75
75
  createLink: string;
76
76
  showLink: (id: string) => string;
77
77
  };
78
- export declare function useCurdViewList<T = CommentListRes & MtUnaryCallError, E = any>(): {
78
+ export declare function useCurdViewList<T = CommontListRes & MtUnaryCallError, E = any>(): {
79
79
  query: import("@tanstack/react-query").UseSuspenseInfiniteQueryResult<import("@tanstack/react-query").InfiniteData<T, unknown>, E>;
80
80
  loadedCount: number;
81
81
  canLoadMore: boolean;
@@ -1 +1 @@
1
- "use client";var h=(a,e,n)=>new Promise((u,p)=>{var s=r=>{try{i(n.next(r))}catch(t){p(t)}},c=r=>{try{i(n.throw(r))}catch(t){p(t)}},i=r=>r.done?u(r.value):Promise.resolve(r.value).then(s,c);i((n=n.apply(a,e)).next())});import{jsxs as J}from"react/jsx-runtime";import{useQueryClient as Q,useSuspenseInfiniteQuery as I}from"@tanstack/react-query";import{toPlainMessage as R}from"gomtm";import{useSuspenseQuery as U}from"gomtm/connectquery";import{curdViewGet as K}from"gomtm/gomtmpb/mtm/sppb/mtm-MtmService_connectquery";import{mtmCallUnaryMethod as O}from"gomtm/mtmFetcher";import{createInfiniteQueryKey as G,createQueryKey as T}from"gomtm/mtmquery";import{useExtInfo as b}from"gomtm/providers/GomtmProvider";import{useIsAdmin as z}from"gomtm/providers/userContext";import{Provider as W,atom as C,createStore as D,useAtom as P}from"jotai";import{usePathname as F}from"next/navigation";import{compile as g,match as v}from"path-to-regexp";import{useCallback as f,useMemo as m}from"react";import{useMtRouter as j}from"../hooks/use-router";const B=C("0"),H=C(null),S=C(""),y=D(),dt=a=>{const{idOrName:e,children:n}=a;return m(()=>{y.set(S,e)},[e]),J(W,{store:y,children:["idOrName:",e,n]})};function ht(){const a=F(),[e,n]=P(B,{store:y}),[u,p]=P(S,{store:y}),s=z(),c=j(),i=Q(),r=U(K,{id:u}),t=m(()=>{var o,d;return(d=(o=r.data)==null?void 0:o.item)==null?void 0:d.value},[r.data]),E=m(()=>s,[s]),L=m(()=>s,[s]),x=m(()=>s,[s]),l=f(o=>t!=null&&t.routeShow?g(t==null?void 0:t.routeShow,{encode:encodeURIComponent})({id:o}):"",[t==null?void 0:t.routeShow]),M=f(o=>{l&&c.push(l(o))},[c,l]),N=f(()=>h(this,null,function*(){t&&(yield i.invalidateQueries({queryKey:G(t.svcName,t.methodList)}))}),[t,i]),k=f(()=>h(this,null,function*(){t&&(yield i.invalidateQueries({queryKey:T(t.svcName,t.methodGet)}))}),[t,i]),q=f(o=>t!=null&&t.routeEdit?g(t==null?void 0:t.routeEdit,{encode:encodeURIComponent})({id:o}):"",[t==null?void 0:t.routeEdit]),A=m(()=>t!=null&&t.routeCreate?g(t==null?void 0:t.routeCreate,{encode:encodeURIComponent})({id:e}):"",[t==null?void 0:t.routeCreate,e]);return m(()=>{if(t!=null&&t.routeShow){const o=v(t.routeShow)(a);o&&n(o.params.id)}else if(t!=null&&t.routeEdit){const o=v(t.routeShow)(a);o&&n(o.params.id)}},[t==null?void 0:t.routeEdit,t==null?void 0:t.routeShow,a,n]),{curdView:t,canEdit:E,canCreate:L,canDelete:x,openShow:M,invalidateList:N,invalidateGet:k,activateId:e,setActivateId:n,editLink:q,createLink:A,showLink:l}}function yt(){const a=b(),[e,n]=P(H),u=I({queryKey:[e==null?void 0:e.svcName,e==null?void 0:e.methodList],queryFn:i=>h(this,null,function*(){const r=yield O(a,(e==null?void 0:e.svcName)||"",(e==null?void 0:e.methodList)||"");return R(r)}),initialPageParam:{},getNextPageParam:()=>{}}),p=(e==null?void 0:e.pageSize)||12,s=m(()=>u.data?u.data.pages.length*p:0,[p,u.data]),c=m(()=>!0,[]);return{query:u,loadedCount:s,canLoadMore:c}}export{dt as CurdViewView,B as activateIdAtom,y as curdStore,H as curdViewAtom,S as curdViewIdAtom,ht as useCurdView,yt as useCurdViewList};
1
+ "use client";var d=(a,e,n)=>new Promise((u,p)=>{var s=r=>{try{i(n.next(r))}catch(t){p(t)}},c=r=>{try{i(n.throw(r))}catch(t){p(t)}},i=r=>r.done?u(r.value):Promise.resolve(r.value).then(s,c);i((n=n.apply(a,e)).next())});import{jsx as J}from"react/jsx-runtime";import{useQueryClient as Q,useSuspenseInfiniteQuery as I}from"@tanstack/react-query";import{toPlainMessage as R}from"gomtm";import{useSuspenseQuery as U}from"gomtm/connectquery";import{curdViewGet as K}from"gomtm/gomtmpb/mtm/sppb/mtm-MtmService_connectquery";import{mtmCallUnaryMethod as G}from"gomtm/mtmFetcher";import{createInfiniteQueryKey as O,createQueryKey as T}from"gomtm/mtmquery";import{useExtInfo as b}from"gomtm/providers/GomtmProvider";import{useIsAdmin as z}from"gomtm/providers/userContext";import{Provider as W,atom as C,createStore as D,useAtom as P}from"jotai";import{usePathname as F}from"next/navigation";import{compile as g,match as v}from"path-to-regexp";import{useCallback as f,useMemo as m}from"react";import{useMtRouter as j}from"../hooks/use-router";const B=C("0"),H=C(null),S=C(""),y=D(),ht=a=>{const{idOrName:e,children:n}=a;return m(()=>{y.set(S,e)},[e]),J(W,{store:y,children:n})};function dt(){const a=F(),[e,n]=P(B,{store:y}),[u,p]=P(S,{store:y}),s=z(),c=j(),i=Q(),r=U(K,{id:u}),t=m(()=>{var o,h;return(h=(o=r.data)==null?void 0:o.item)==null?void 0:h.value},[r.data]),E=m(()=>s,[s]),L=m(()=>s,[s]),x=m(()=>s,[s]),l=f(o=>t!=null&&t.routeShow?g(t==null?void 0:t.routeShow,{encode:encodeURIComponent})({id:o}):"",[t==null?void 0:t.routeShow]),M=f(o=>{l&&c.push(l(o))},[c,l]),N=f(()=>d(this,null,function*(){t&&(yield i.invalidateQueries({queryKey:O(t.svcName,t.methodList)}))}),[t,i]),k=f(()=>d(this,null,function*(){t&&(yield i.invalidateQueries({queryKey:T(t.svcName,t.methodGet)}))}),[t,i]),q=f(o=>t!=null&&t.routeEdit?g(t==null?void 0:t.routeEdit,{encode:encodeURIComponent})({id:o}):"",[t==null?void 0:t.routeEdit]),A=m(()=>t!=null&&t.routeCreate?g(t==null?void 0:t.routeCreate,{encode:encodeURIComponent})({id:e}):"",[t==null?void 0:t.routeCreate,e]);return m(()=>{if(t!=null&&t.routeShow){const o=v(t.routeShow)(a);o&&n(o.params.id)}else if(t!=null&&t.routeEdit){const o=v(t.routeShow)(a);o&&n(o.params.id)}},[t==null?void 0:t.routeEdit,t==null?void 0:t.routeShow,a,n]),{curdView:t,canEdit:E,canCreate:L,canDelete:x,openShow:M,invalidateList:N,invalidateGet:k,activateId:e,setActivateId:n,editLink:q,createLink:A,showLink:l}}function yt(){const a=b(),[e,n]=P(H),u=I({queryKey:[e==null?void 0:e.svcName,e==null?void 0:e.methodList],queryFn:i=>d(this,null,function*(){const r=yield G(a,(e==null?void 0:e.svcName)||"",(e==null?void 0:e.methodList)||"");return R(r)}),initialPageParam:{},getNextPageParam:()=>{}}),p=(e==null?void 0:e.pageSize)||12,s=m(()=>u.data?u.data.pages.length*p:0,[p,u.data]),c=m(()=>!0,[]);return{query:u,loadedCount:s,canLoadMore:c}}export{ht as CurdViewView,B as activateIdAtom,y as curdStore,H as curdViewAtom,S as curdViewIdAtom,dt as useCurdView,yt as useCurdViewList};
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const CurdEditButton: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{Fragment as o,jsx as i}from"react/jsx-runtime";import{MtLink as r}from"../common/mtlink";import{useCurdView as e}from"./CurdViewView";const u=()=>{const t=e();return i(o,{children:i(r,{href:t.editLink(t.activateId),children:"edit"})})};export{u as CurdEditButton};