gomtm 0.0.291 → 0.0.293

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.
Files changed (44) hide show
  1. package/dist/esm/components/devtools/GoMtmDebug.d.ts +1 -1
  2. package/dist/esm/components/devtools/GoMtmDebug.js +12 -3
  3. package/dist/esm/consts.d.ts +3 -10
  4. package/dist/esm/consts.js +7 -12
  5. package/dist/esm/curd/list-item/ListLayout.d.ts +1 -1
  6. package/dist/esm/curd/listview/ListViewProvider.d.ts +1 -0
  7. package/dist/esm/curd/listview/ListViewProvider.js +24 -1
  8. package/dist/esm/curd/listview/list-store.d.ts +6 -9
  9. package/dist/esm/curd/listview/list-store.js +45 -2
  10. package/dist/esm/gomtmQuery.js +23 -7
  11. package/dist/esm/ly/LayoutBase.js +2 -2
  12. package/dist/esm/ly/UserAvatorMenus.js +1 -0
  13. package/dist/esm/mtmFetcher.d.ts +4 -2
  14. package/dist/esm/mtmFetcher.js +12 -6
  15. package/dist/esm/providers/AuthProvider.d.ts +1 -4
  16. package/dist/esm/providers/AuthProvider.js +12 -8
  17. package/dist/esm/providers/GomtmAppSS.js +28 -21
  18. package/dist/esm/store/GomtmAppSetting.d.ts +2 -0
  19. package/dist/esm/store/GomtmAppSetting.js +18 -0
  20. package/dist/esm/store/customStorage.d.ts +2 -0
  21. package/dist/esm/store/customStorage.js +35 -0
  22. package/dist/esm/store/mtapp-store.d.ts +24 -9
  23. package/dist/esm/store/mtapp-store.js +50 -17
  24. package/dist/esm/validations/spContentModi.d.ts +4 -4
  25. package/dist/esm/validations/spRoute.d.ts +4 -4
  26. package/dist/esm/validations/user.d.ts +6 -6
  27. package/dist/tsconfig.type.tsbuildinfo +1 -1
  28. package/package.json +3 -3
  29. package/dist/esm/curd/CurdDetailProvider.d.ts +0 -0
  30. package/dist/esm/curd/CurdDetailProvider.js +0 -0
  31. package/dist/esm/providers/ConfigStateProvider.d.ts +0 -0
  32. package/dist/esm/providers/ConfigStateProvider.js +0 -0
  33. package/dist/esm/providers/GomtmProvider.d.ts +0 -4
  34. package/dist/esm/providers/GomtmProvider.js +0 -1
  35. package/dist/esm/providers/ListViewProvider.d.ts +0 -12
  36. package/dist/esm/providers/ListViewProvider.js +0 -47
  37. package/dist/esm/providers/counter-store-provider.d.ts +0 -9
  38. package/dist/esm/providers/counter-store-provider.js +0 -32
  39. package/dist/esm/store/config-store.d.ts +0 -0
  40. package/dist/esm/store/config-store.js +0 -0
  41. package/dist/esm/store/counter-store.d.ts +0 -11
  42. package/dist/esm/store/counter-store.js +0 -37
  43. package/dist/esm/store/list-store.d.ts +0 -25
  44. package/dist/esm/store/list-store.js +0 -97
@@ -1,30 +1,45 @@
1
1
  import { PropsWithChildren } from 'react';
2
- export interface ConfigState {
2
+ export type ActionHandler = (props: {
3
+ action: string;
4
+ values?: any;
5
+ }) => void;
6
+ interface GomtmAppProps {
3
7
  debug?: boolean;
4
- theme?: string;
5
- layout?: string;
6
8
  listviewLayout?: string;
9
+ cacheEnabled?: boolean;
7
10
  backendUrl?: string;
8
- }
9
- interface GomtmAppProps {
10
- debug?: boolean;
11
- configState: ConfigState;
12
- params: any;
11
+ layout?: string;
12
+ theme?: string;
13
+ counter?: number;
14
+ params?: any;
13
15
  cookieStr?: string;
14
16
  globalSearchParams?: any;
15
17
  openDebug?: boolean;
16
18
  }
17
19
  interface GomtmAppState extends GomtmAppProps {
18
20
  loading?: boolean;
21
+ setCounter: (counter: number) => void;
19
22
  setLoading: (loading: boolean) => void;
20
23
  setDebug: (debug: boolean) => void;
21
24
  setLayout: (layout: string) => void;
22
25
  setGlobalSearchParams: (globalSearchParams: any) => void;
23
26
  setOpenDebug: (openDebug: boolean) => void;
27
+ setCacheEnabled: (cacheEnabled: boolean) => void;
24
28
  }
25
- export declare const BearContext: import("react").Context<import("zustand").StoreApi<GomtmAppState> | null>;
29
+ export declare const BearContext: import("react").Context<(Omit<import("zustand").StoreApi<GomtmAppState>, "persist"> & {
30
+ persist: {
31
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<GomtmAppState, unknown>>) => void;
32
+ clearStorage: () => void;
33
+ rehydrate: () => void | Promise<void>;
34
+ hasHydrated: () => boolean;
35
+ onHydrate: (fn: (state: GomtmAppState) => void) => () => void;
36
+ onFinishHydration: (fn: (state: GomtmAppState) => void) => () => void;
37
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<GomtmAppState, unknown>>;
38
+ };
39
+ }) | null>;
26
40
  type BearProviderProps = React.PropsWithChildren<GomtmAppProps>;
27
41
  export declare const GoMtmAppProvider: (props: BearProviderProps) => import("react").JSX.Element;
28
42
  export declare function useGomtm<T>(selector: (state: GomtmAppState) => T): T;
29
43
  export declare const MtConnectProvider: (props: PropsWithChildren) => import("react").JSX.Element;
44
+ export declare const DebugCounter: () => import("react").JSX.Element;
30
45
  export {};
@@ -32,33 +32,54 @@ var __objRest = (source, exclude) => {
32
32
  };
33
33
  import { jsx, jsxs } from "react/jsx-runtime";
34
34
  import { createConnectTransport } from "@connectrpc/connect-web";
35
+ import { MtButton } from "mtxuilib/ui/ui-mt/Button";
35
36
  import { createContext, useContext, useMemo, useRef } from "react";
36
37
  import { useHotkeys } from "react-hotkeys-hook";
37
38
  import { useStore } from "zustand";
39
+ import { createJSONStorage, persist } from "zustand/middleware";
38
40
  import { createStore } from "zustand/vanilla";
39
41
  import { GoMtmDebug } from "../components/devtools/GoMtmDebug";
40
42
  import { TransportProvider } from "../connectquery";
41
- import { HOTKEY_Debug } from "../consts";
43
+ import { CookieConfigState, HOTKEY_Debug } from "../consts";
42
44
  import { anypbTypeReg } from "../messageTypeRegistry";
43
45
  import { gomtmFetcher } from "../mtmFetcher";
44
46
  import { MtReactQueryProvider } from "../providers/ReactQueryProvider";
47
+ import { customCookieStorage } from "./customStorage";
45
48
  const createGomtmAppStore = (initProps) => {
46
49
  const DEFAULT_PROPS = {
47
50
  debug: false,
48
- configState: {},
49
- params: {}
51
+ // configState: {},
52
+ params: {},
53
+ counter: 0
50
54
  };
51
- return createStore()((set) => __spreadProps(__spreadValues(__spreadValues({}, DEFAULT_PROPS), initProps), {
52
- setLoading: (loading) => set({ loading }),
53
- setDebug: (debug) => set((state) => __spreadProps(__spreadValues({}, state), { configState: __spreadProps(__spreadValues({}, state.configState), { debug }) })),
54
- setLayout: (layout) => set((state) => __spreadProps(__spreadValues({}, state), { configState: __spreadProps(__spreadValues({}, state.configState), { layout }) })),
55
- setGlobalSearchParams: (globalSearchParams) => {
56
- console.log("setGlobalSearchParams", globalSearchParams);
57
- return set({ globalSearchParams });
58
- },
59
- openDebug: false,
60
- setOpenDebug: (openDebug) => set({ openDebug })
61
- }));
55
+ return createStore()(
56
+ persist(
57
+ (set) => __spreadProps(__spreadValues(__spreadValues({}, DEFAULT_PROPS), initProps), {
58
+ setLoading: (loading) => set({ loading }),
59
+ setDebug: (debug) => set({ debug }),
60
+ setLayout: (layout) => set({ layout }),
61
+ setCacheEnabled: (cacheEnabled) => set({ cacheEnabled }),
62
+ setCounter: (counter) => set({ counter }),
63
+ setGlobalSearchParams: (globalSearchParams) => set({ globalSearchParams }),
64
+ openDebug: false,
65
+ setOpenDebug: (openDebug) => set({ openDebug })
66
+ }),
67
+ {
68
+ name: CookieConfigState,
69
+ // name of the item in the storage (must be unique)
70
+ storage: createJSONStorage(() => customCookieStorage),
71
+ partialize: (state) => {
72
+ return Object.fromEntries(
73
+ Object.entries(state).filter(
74
+ ([key]) => {
75
+ return !["cookieStr", "children"].includes(key);
76
+ }
77
+ )
78
+ );
79
+ }
80
+ }
81
+ )
82
+ );
62
83
  };
63
84
  const BearContext = createContext(null);
64
85
  const GoMtmAppProvider = (props) => {
@@ -69,8 +90,8 @@ const GoMtmAppProvider = (props) => {
69
90
  }
70
91
  return /* @__PURE__ */ jsx(BearContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsxs(MtConnectProvider, { children: [
71
92
  /* @__PURE__ */ jsxs(MtReactQueryProvider, { children: [
72
- children,
73
- /* @__PURE__ */ jsx(GoMtmDebug, {})
93
+ /* @__PURE__ */ jsx(GoMtmDebug, {}),
94
+ children
74
95
  ] }),
75
96
  /* @__PURE__ */ jsx(Setup, {})
76
97
  ] }) });
@@ -92,7 +113,7 @@ const Setup = () => {
92
113
  };
93
114
  const MtConnectProvider = (props) => {
94
115
  const { children } = props;
95
- const backendUrl = useGomtm((x) => x.configState.backendUrl);
116
+ const backendUrl = useGomtm((x) => x.backendUrl);
96
117
  const cookieStr = useGomtm((x) => x.cookieStr);
97
118
  const transport = useMemo(() => {
98
119
  const baseApiUrl = new URL("/api", backendUrl || "").toString();
@@ -110,8 +131,20 @@ const MtConnectProvider = (props) => {
110
131
  }, [backendUrl, cookieStr]);
111
132
  return /* @__PURE__ */ jsx(TransportProvider, { transport, children });
112
133
  };
134
+ const DebugCounter = () => {
135
+ const counter = useGomtm((x) => x.counter);
136
+ const setCounter = useGomtm((x) => x.setCounter);
137
+ return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(MtButton, { onClick: () => {
138
+ setCounter((counter || 0) + 1);
139
+ }, children: [
140
+ "counter:(",
141
+ counter,
142
+ ")"
143
+ ] }) });
144
+ };
113
145
  export {
114
146
  BearContext,
147
+ DebugCounter,
115
148
  GoMtmAppProvider,
116
149
  MtConnectProvider,
117
150
  useGomtm
@@ -23,15 +23,15 @@ export declare const spContentModiCreateInput: z.ZodObject<{
23
23
  }, "strip", z.ZodTypeAny, {
24
24
  value: string;
25
25
  action: string;
26
- sel: string;
27
26
  spRouteId: string;
27
+ sel: string;
28
28
  matchContentType: string;
29
29
  title?: string | undefined;
30
30
  }, {
31
31
  value: string;
32
32
  action: string;
33
- sel: string;
34
33
  spRouteId: string;
34
+ sel: string;
35
35
  matchContentType: string;
36
36
  title?: string | undefined;
37
37
  }>;
@@ -47,16 +47,16 @@ export declare const spContentModiSaveInput: z.ZodObject<{
47
47
  value: string;
48
48
  id: string;
49
49
  action: string;
50
- sel: string;
51
50
  spRouteId: string;
51
+ sel: string;
52
52
  matchContentType: string;
53
53
  title?: string | undefined;
54
54
  }, {
55
55
  value: string;
56
56
  id: string;
57
57
  action: string;
58
- sel: string;
59
58
  spRouteId: string;
59
+ sel: string;
60
60
  matchContentType: string;
61
61
  title?: string | undefined;
62
62
  }>;
@@ -22,15 +22,15 @@ export declare const spRouteCreateInput: z.ZodObject<{
22
22
  }, "strip", z.ZodTypeAny, {
23
23
  value: string;
24
24
  title: string;
25
- spProjectId: string;
26
25
  hostPattern: string;
27
26
  pathPattern: string;
27
+ spProjectId: string;
28
28
  }, {
29
29
  value: string;
30
30
  title: string;
31
- spProjectId: string;
32
31
  hostPattern: string;
33
32
  pathPattern: string;
33
+ spProjectId: string;
34
34
  }>;
35
35
  export type SpRouteSaveInput = z.infer<typeof SpRouteSaveInput>;
36
36
  export declare const SpRouteSaveInput: z.ZodObject<{
@@ -44,14 +44,14 @@ export declare const SpRouteSaveInput: z.ZodObject<{
44
44
  value: string;
45
45
  id: string;
46
46
  title: string;
47
- spProjectId: string;
48
47
  hostPattern: string;
49
48
  pathPattern: string;
49
+ spProjectId: string;
50
50
  }, {
51
51
  value: string;
52
52
  id: string;
53
53
  title: string;
54
- spProjectId: string;
55
54
  hostPattern: string;
56
55
  pathPattern: string;
56
+ spProjectId: string;
57
57
  }>;
@@ -27,11 +27,11 @@ export declare const createUserSchema: z.ZodObject<{
27
27
  name: z.ZodString;
28
28
  email: z.ZodString;
29
29
  }, "strip", z.ZodTypeAny, {
30
- email: string;
31
30
  name: string;
32
- }, {
33
31
  email: string;
32
+ }, {
34
33
  name: string;
34
+ email: string;
35
35
  }>;
36
36
  export type ICreateUser = z.infer<typeof createUserSchema>;
37
37
  export declare const Oauth2LoginResponseSchema: z.ZodObject<{
@@ -42,23 +42,23 @@ export declare const Oauth2LoginResponseSchema: z.ZodObject<{
42
42
  }, "strip", z.ZodTypeAny, {
43
43
  accessToken: string;
44
44
  id: string;
45
- userName: string;
46
45
  roles: string[];
46
+ userName: string;
47
47
  }, {
48
48
  accessToken: string;
49
49
  id: string;
50
- userName: string;
51
50
  roles: string[];
51
+ userName: string;
52
52
  }>;
53
53
  export type Oauth2LoginResponse = z.infer<typeof Oauth2LoginResponseSchema>;
54
54
  export declare const MeResponseSchema: z.ZodObject<{
55
55
  userName: z.ZodString;
56
56
  roles: z.ZodArray<z.ZodString, "many">;
57
57
  }, "strip", z.ZodTypeAny, {
58
- userName: string;
59
58
  roles: string[];
60
- }, {
61
59
  userName: string;
60
+ }, {
62
61
  roles: string[];
62
+ userName: string;
63
63
  }>;
64
64
  export type MeResponse = z.infer<typeof MeResponseSchema>;