gomtm 0.0.179 → 0.0.180
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/esm/validations/spContentModi.d.ts +4 -4
- package/dist/esm/validations/spRoute.d.ts +4 -4
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/esm/clientlib.d.ts +0 -6
- package/dist/esm/clientlib.js +0 -44
- package/dist/esm/components/ListItem.d.ts +0 -6
- package/dist/esm/components/ListItem.js +0 -49
- package/dist/esm/components/blog/post.atoms.d.ts +0 -11
- package/dist/esm/components/blog/post.atoms.js +0 -9
- package/dist/esm/components/formFieldRender/SchemaFormView.d.ts +0 -14
- package/dist/esm/components/formFieldRender/SchemaFormView.js +0 -44
- package/dist/esm/curd/CurdListViewV3.d.ts +0 -16
- package/dist/esm/curd/CurdListViewV3.js +0 -99
- package/dist/esm/curd/CurdViewView.d.ts +0 -63
- package/dist/esm/curd/CurdViewView.js +0 -90
- package/dist/esm/gomtm-clients.d.ts +0 -1
- package/dist/esm/gomtm-clients.js +0 -9
- package/dist/esm/http/cors.d.ts +0 -15
- package/dist/esm/http/cors.js +0 -129
- package/dist/esm/jotai-helper.d.ts +0 -23
- package/dist/esm/jotai-helper.js +0 -96
- package/dist/esm/providers/MtConnectProvider.d.ts +0 -2
- package/dist/esm/providers/MtConnectProvider.js +0 -13
- package/dist/esm/providers/MtConnectProviderV2.d.ts +0 -4
- package/dist/esm/providers/MtConnectProviderV2.js +0 -17
- package/dist/esm/providers/userContext.d.ts +0 -1
- package/dist/esm/providers/userContext.js +0 -19
- package/dist/esm/store/CurdListViewV3.d.ts +0 -13
- package/dist/esm/store/CurdListViewV3.js +0 -78
- package/dist/esm/store/GomtmBackendProvider.d.ts +0 -12
- package/dist/esm/store/GomtmBackendProvider.js +0 -49
- package/dist/esm/utils.d.ts +0 -1
- package/dist/esm/utils.js +0 -32
- package/dist/gomtm +0 -0
package/package.json
CHANGED
package/dist/esm/clientlib.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>;
|
|
3
|
-
export declare function getCookie(name: string): string | undefined;
|
|
4
|
-
export declare function deleteCookie(name: string): void;
|
|
5
|
-
export declare function deleteAllCookies(): void;
|
|
6
|
-
export declare function setCookie(name: string, value: any): void;
|
package/dist/esm/clientlib.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function mergeRefs(refs) {
|
|
3
|
-
return (value) => {
|
|
4
|
-
refs.forEach((ref) => {
|
|
5
|
-
if (typeof ref === "function") {
|
|
6
|
-
ref(value);
|
|
7
|
-
} else if (ref != null) {
|
|
8
|
-
;
|
|
9
|
-
ref.current = value;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function getCookie(name) {
|
|
15
|
-
const cookieArr = document.cookie.split(";");
|
|
16
|
-
for (let i = 0; i < cookieArr.length; i++) {
|
|
17
|
-
const cookiePair = cookieArr[i].split("=");
|
|
18
|
-
if (name == cookiePair[0].trim()) {
|
|
19
|
-
return decodeURIComponent(cookiePair[1]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function deleteCookie(name) {
|
|
24
|
-
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
|
|
25
|
-
}
|
|
26
|
-
function deleteAllCookies() {
|
|
27
|
-
const cookies = document.cookie.split(";");
|
|
28
|
-
for (let i = 0; i < cookies.length; i++) {
|
|
29
|
-
const cookie = cookies[i];
|
|
30
|
-
const eqPos = cookie.indexOf("=");
|
|
31
|
-
const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
|
|
32
|
-
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function setCookie(name, value) {
|
|
36
|
-
document.cookie = `${name}=${value}`;
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
deleteAllCookies,
|
|
40
|
-
deleteCookie,
|
|
41
|
-
getCookie,
|
|
42
|
-
mergeRefs,
|
|
43
|
-
setCookie
|
|
44
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { MtLink } from "mtxuilib/common/mtlink";
|
|
4
|
-
import { cn } from "mtxuilib/lib/utils";
|
|
5
|
-
import { MtButton } from "mtxuilib/ui/ui-mt/Button";
|
|
6
|
-
import { useCurdView } from "../curd/CurdViewView";
|
|
7
|
-
import { PostCard } from "./blog/PostCard";
|
|
8
|
-
const ListItemView = (props) => {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
const { item } = props;
|
|
11
|
-
if ((_a = item == null ? void 0 : item.item) == null ? void 0 : _a.value) {
|
|
12
|
-
const itemCase = ((_b = item.item) == null ? void 0 : _b.case) || "";
|
|
13
|
-
switch (itemCase) {
|
|
14
|
-
case "commonListItem":
|
|
15
|
-
return /* @__PURE__ */ jsx(CommonListItemView, { item: item.item.value });
|
|
16
|
-
case "postCard":
|
|
17
|
-
return /* @__PURE__ */ jsx(PostCard, { item: item.item.value });
|
|
18
|
-
default:
|
|
19
|
-
return /* @__PURE__ */ jsx("span", { className: "bg-red-600 p-2", children: "unknow list item type" });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
};
|
|
24
|
-
const CommonListItemView = (props) => {
|
|
25
|
-
const { item } = props;
|
|
26
|
-
const curd = useCurdView();
|
|
27
|
-
const handleSelect = () => {
|
|
28
|
-
curd.openShow(item.id);
|
|
29
|
-
};
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
31
|
-
MtButton,
|
|
32
|
-
{
|
|
33
|
-
variant: "ghost",
|
|
34
|
-
onClick: handleSelect,
|
|
35
|
-
className: cn(
|
|
36
|
-
"flex min-h-16 justify-start border p-4 text-left",
|
|
37
|
-
item.id == curd.activateId && " font-bold"
|
|
38
|
-
),
|
|
39
|
-
"aria-label": item.id,
|
|
40
|
-
children: /* @__PURE__ */ jsxs(MtLink, { href: curd.showLink(item.id), children: [
|
|
41
|
-
item.title || item.id,
|
|
42
|
-
item.description && /* @__PURE__ */ jsx("div", { children: item.description })
|
|
43
|
-
] })
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
export {
|
|
48
|
-
ListItemView
|
|
49
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { PlainMessage } from "@bufbuild/protobuf";
|
|
2
|
-
import { BlogPost, BlogPostGetReq } from "../../gomtmpb/mtm/sppb/mtm_pb";
|
|
3
|
-
export declare const postDetailAtom: import("jotai").PrimitiveAtom<PlainMessage<BlogPost> | null> & {
|
|
4
|
-
init: PlainMessage<BlogPost> | null;
|
|
5
|
-
};
|
|
6
|
-
export declare const postIdAtom: import("jotai").PrimitiveAtom<string | null> & {
|
|
7
|
-
init: string | null;
|
|
8
|
-
};
|
|
9
|
-
export declare const blogPostGetReqAtom: import("jotai").PrimitiveAtom<Partial<PlainMessage<BlogPostGetReq>> | undefined> & {
|
|
10
|
-
init: Partial<PlainMessage<BlogPostGetReq>> | undefined;
|
|
11
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PlainMessage } from "@bufbuild/protobuf";
|
|
3
|
-
import { MaybePromise } from "mtxlib";
|
|
4
|
-
import { FormSchema } from "../../gomtmpb/mtm/sppb/mtm_pb";
|
|
5
|
-
type SchemaFormViewVaranit = "auto" | "modal" | "card";
|
|
6
|
-
export declare const SchemaFormView: (props: {
|
|
7
|
-
formSchema?: PlainMessage<FormSchema> | undefined;
|
|
8
|
-
defaultValues?: any;
|
|
9
|
-
onSubmit: (values: any) => MaybePromise<void>;
|
|
10
|
-
onCancel?: (() => void) | undefined;
|
|
11
|
-
isLoading?: boolean | undefined;
|
|
12
|
-
variants?: SchemaFormViewVaranit | undefined;
|
|
13
|
-
}) => import("react").JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { useState } from "react";
|
|
23
|
-
import { FormProvider, useForm } from "react-hook-form";
|
|
24
|
-
import { EditFormToolbar } from "mtxuilib/form/EditFormToolbar";
|
|
25
|
-
import { Card, CardContent } from "mtxuilib/ui/card";
|
|
26
|
-
import { DialogFooter } from "mtxuilib/ui/dialog";
|
|
27
|
-
import { SchemaFormFieldsRender } from "./SchemaFormFieldsRender";
|
|
28
|
-
const SchemaFormView = (props) => {
|
|
29
|
-
const { formSchema, onSubmit, onCancel, variants } = props;
|
|
30
|
-
const [defaultValues, setDefaultValues] = useState({});
|
|
31
|
-
const form = useForm({
|
|
32
|
-
defaultValues
|
|
33
|
-
});
|
|
34
|
-
if (!formSchema) {
|
|
35
|
-
return /* @__PURE__ */ jsx("div", { className: "border p-8", children: "missing formSchema params" });
|
|
36
|
-
}
|
|
37
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(FormProvider, __spreadProps(__spreadValues({}, form), { children: /* @__PURE__ */ jsx(Card, { className: "p-2", children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("form", { onSubmit, children: [
|
|
38
|
-
/* @__PURE__ */ jsx(SchemaFormFieldsRender, { schema: formSchema }),
|
|
39
|
-
/* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(EditFormToolbar, { onCancel: () => onCancel && onCancel() }) })
|
|
40
|
-
] }) }) }) })) });
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
SchemaFormView
|
|
44
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AnyMessage, Message, PlainMessage } from "@bufbuild/protobuf";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
import { MethodUnaryDescriptor } from "../connectquery";
|
|
4
|
-
export declare const curd3activateIdAtom: import("jotai").PrimitiveAtom<string> & {
|
|
5
|
-
init: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function Curd3ListProvider<I extends Message<I>, O extends Message<O>>(props: {
|
|
8
|
-
params: Partial<PlainMessage<I>>;
|
|
9
|
-
methodList: MethodUnaryDescriptor<I, O>;
|
|
10
|
-
} & PropsWithChildren): import("react").JSX.Element;
|
|
11
|
-
export declare const useCurd3List: () => {
|
|
12
|
-
params: PlainMessage<AnyMessage>;
|
|
13
|
-
curd3MethodList: MethodUnaryDescriptor<AnyMessage, AnyMessage> | null;
|
|
14
|
-
};
|
|
15
|
-
export declare const Curd2ListView: () => import("react").JSX.Element;
|
|
16
|
-
export declare const Curd3ListViewDebug: () => import("react").JSX.Element;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __async = (__this, __arguments, generator) => {
|
|
3
|
-
return new Promise((resolve, reject) => {
|
|
4
|
-
var fulfilled = (value) => {
|
|
5
|
-
try {
|
|
6
|
-
step(generator.next(value));
|
|
7
|
-
} catch (e) {
|
|
8
|
-
reject(e);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
var rejected = (value) => {
|
|
12
|
-
try {
|
|
13
|
-
step(generator.throw(value));
|
|
14
|
-
} catch (e) {
|
|
15
|
-
reject(e);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
import { atom, useAtom } from "jotai";
|
|
24
|
-
import { ScopeProvider } from "mtxlib/jotai/ScopeProvider";
|
|
25
|
-
import { AtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
26
|
-
import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
|
|
27
|
-
import { callUnaryMethod } from "../connectquery";
|
|
28
|
-
import { ListViewLayout } from "../gomtmpb/mtm/sppb/mtm_pb";
|
|
29
|
-
import { gomtmBaseUrlAtom, transportAtom } from "../store/GomtmBackendProvider";
|
|
30
|
-
import { ListItemView } from "./list-item/ListItem";
|
|
31
|
-
const curd3activateIdAtom = atom("");
|
|
32
|
-
const curd3ListParamsAtom = atom({});
|
|
33
|
-
const curd3MethodListAtom = atom(null);
|
|
34
|
-
const curd3ItemsAtom = atom((get) => __async(void 0, null, function* () {
|
|
35
|
-
const params = get(curd3ListParamsAtom);
|
|
36
|
-
const methodList = get(curd3MethodListAtom);
|
|
37
|
-
if (!methodList) {
|
|
38
|
-
throw new Error("curd3ItemsAtom, missing methodList");
|
|
39
|
-
}
|
|
40
|
-
const transport = get(transportAtom);
|
|
41
|
-
const data = yield callUnaryMethod(methodList, params, { transport });
|
|
42
|
-
return data;
|
|
43
|
-
}));
|
|
44
|
-
function Curd3ListProvider(props) {
|
|
45
|
-
const { params, methodList, children } = props;
|
|
46
|
-
return /* @__PURE__ */ jsx(ScopeProvider, { atoms: [curd3ListParamsAtom, curd3MethodListAtom], children: /* @__PURE__ */ jsx(AtomsHydrator, { atomValues: [
|
|
47
|
-
[curd3ListParamsAtom, params],
|
|
48
|
-
[curd3MethodListAtom, methodList]
|
|
49
|
-
], children }) });
|
|
50
|
-
}
|
|
51
|
-
const useCurd3List = () => {
|
|
52
|
-
const [curd3ListParams] = useAtom(curd3ListParamsAtom);
|
|
53
|
-
const [curd3MethodList] = useAtom(curd3MethodListAtom);
|
|
54
|
-
return {
|
|
55
|
-
params: curd3ListParams,
|
|
56
|
-
curd3MethodList
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const Curd2ListView = () => {
|
|
60
|
-
const [res] = useAtom(curd3ItemsAtom);
|
|
61
|
-
return /* @__PURE__ */ jsx("div", { className: "bg-blue-100 p-2", children: res.errCode ? /* @__PURE__ */ jsx(MtUnaryCallErrorView, { unaryError: res }) : /* @__PURE__ */ jsx(Fragment, { children: res.items.map((item, i) => {
|
|
62
|
-
return /* @__PURE__ */ jsx(ListItemView, { item }, i);
|
|
63
|
-
}) }) });
|
|
64
|
-
};
|
|
65
|
-
const ListLayout = (props) => {
|
|
66
|
-
const { children } = props;
|
|
67
|
-
switch (props.layout) {
|
|
68
|
-
case ListViewLayout.simple:
|
|
69
|
-
return /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1 rounded-md p-2 shadow-sm", children });
|
|
70
|
-
case ListViewLayout.grid:
|
|
71
|
-
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
|
|
72
|
-
case ListViewLayout.card:
|
|
73
|
-
return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 grid-rows-3 gap-4 px-4 lg:grid-cols-3", children });
|
|
74
|
-
default:
|
|
75
|
-
return children;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const Curd3ListViewDebug = () => {
|
|
79
|
-
const curd3 = useCurd3List();
|
|
80
|
-
const [gomtmBaseUrl] = useAtom(gomtmBaseUrlAtom);
|
|
81
|
-
return /* @__PURE__ */ jsxs("div", { className: "bg-slate-200 p-2", children: [
|
|
82
|
-
/* @__PURE__ */ jsx("h1", { children: "Curd3ListViewDebug" }),
|
|
83
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
84
|
-
"params: ",
|
|
85
|
-
/* @__PURE__ */ jsx("pre", { children: JSON.stringify(curd3, null, 2) })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
88
|
-
"gomtmBaseUrl:",
|
|
89
|
-
gomtmBaseUrl
|
|
90
|
-
] })
|
|
91
|
-
] });
|
|
92
|
-
};
|
|
93
|
-
export {
|
|
94
|
-
Curd2ListView,
|
|
95
|
-
Curd3ListProvider,
|
|
96
|
-
Curd3ListViewDebug,
|
|
97
|
-
curd3activateIdAtom,
|
|
98
|
-
useCurd3List
|
|
99
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { PlainMessage } from "@bufbuild/protobuf";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
import { CurdView } from "../gomtmpb/mtm/sppb/mtm_pb";
|
|
4
|
-
export declare const activateIdAtom: import("jotai").PrimitiveAtom<string> & {
|
|
5
|
-
init: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const curdViewAtom: import("jotai").PrimitiveAtom<PlainMessage<CurdView> | null | undefined> & {
|
|
8
|
-
init: PlainMessage<CurdView> | null | undefined;
|
|
9
|
-
};
|
|
10
|
-
export declare const curdViewIdAtom: import("jotai").PrimitiveAtom<string> & {
|
|
11
|
-
init: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const curdStore: {
|
|
14
|
-
get: <Value>(atom: import("jotai").Atom<Value>) => Value;
|
|
15
|
-
set: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
|
|
16
|
-
sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
|
|
17
|
-
} & Partial<{
|
|
18
|
-
dev_subscribe_store: (l: (action: {
|
|
19
|
-
type: "write";
|
|
20
|
-
flushed: Set<import("jotai").Atom<unknown>>;
|
|
21
|
-
} | {
|
|
22
|
-
type: "async-write";
|
|
23
|
-
flushed: Set<import("jotai").Atom<unknown>>;
|
|
24
|
-
} | {
|
|
25
|
-
type: "sub";
|
|
26
|
-
flushed: Set<import("jotai").Atom<unknown>>;
|
|
27
|
-
} | {
|
|
28
|
-
type: "unsub";
|
|
29
|
-
} | {
|
|
30
|
-
type: "restore";
|
|
31
|
-
flushed: Set<import("jotai").Atom<unknown>>;
|
|
32
|
-
}) => void, rev: 2) => () => void;
|
|
33
|
-
dev_get_mounted_atoms: () => IterableIterator<import("jotai").Atom<unknown>>;
|
|
34
|
-
dev_get_atom_state: (a: import("jotai").Atom<unknown>) => ({
|
|
35
|
-
d: Map<import("jotai").Atom<unknown>, any & ({
|
|
36
|
-
e: unknown;
|
|
37
|
-
} | {
|
|
38
|
-
v: unknown;
|
|
39
|
-
})>;
|
|
40
|
-
} & ({
|
|
41
|
-
e: unknown;
|
|
42
|
-
} | {
|
|
43
|
-
v: unknown;
|
|
44
|
-
})) | undefined;
|
|
45
|
-
dev_get_mounted: (a: import("jotai").Atom<unknown>) => {
|
|
46
|
-
l: Set<() => void>;
|
|
47
|
-
t: Set<import("jotai").Atom<unknown>>;
|
|
48
|
-
u?: (() => void) | undefined;
|
|
49
|
-
} | undefined;
|
|
50
|
-
dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
|
|
51
|
-
}>;
|
|
52
|
-
export declare const CurdViewView: (props: {
|
|
53
|
-
idOrName: string;
|
|
54
|
-
} & PropsWithChildren) => import("react").JSX.Element;
|
|
55
|
-
export declare function useCurdView(): {
|
|
56
|
-
curdView: CurdView;
|
|
57
|
-
openShow: (id: string) => void;
|
|
58
|
-
activateId: string;
|
|
59
|
-
setActivateId: (args_0: string | ((prev: string) => string)) => void;
|
|
60
|
-
editLink: (id: string) => string;
|
|
61
|
-
createLink: string;
|
|
62
|
-
showLink: (id: string) => string;
|
|
63
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
import { atom, createStore, useAtom } from "jotai";
|
|
5
|
-
import { useMtRouter } from "mtxuilib/hooks/use-router";
|
|
6
|
-
import { usePathname } from "next/navigation";
|
|
7
|
-
import { compile, match } from "path-to-regexp";
|
|
8
|
-
import { useCallback, useMemo } from "react";
|
|
9
|
-
import { useSuspenseQuery } from "../connectquery";
|
|
10
|
-
import { curdViewGet } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
|
|
11
|
-
const activateIdAtom = atom("0");
|
|
12
|
-
const curdViewAtom = atom(null);
|
|
13
|
-
const curdViewIdAtom = atom("");
|
|
14
|
-
const curdStore = createStore();
|
|
15
|
-
const CurdViewView = (props) => {
|
|
16
|
-
const { idOrName, children } = props;
|
|
17
|
-
useMemo(() => {
|
|
18
|
-
curdStore.set(curdViewIdAtom, idOrName);
|
|
19
|
-
}, [idOrName]);
|
|
20
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
21
|
-
};
|
|
22
|
-
function useCurdView() {
|
|
23
|
-
const pathName = usePathname();
|
|
24
|
-
const [activateId, setActivateId] = useAtom(activateIdAtom, { store: curdStore });
|
|
25
|
-
const [curdViewId, setCurdViewId] = useAtom(curdViewIdAtom, { store: curdStore });
|
|
26
|
-
const router = useMtRouter();
|
|
27
|
-
const queryClient = useQueryClient();
|
|
28
|
-
const query = useSuspenseQuery(curdViewGet, { id: curdViewId });
|
|
29
|
-
const curdView = useMemo(() => {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
return (_b = (_a = query.data) == null ? void 0 : _a.item) == null ? void 0 : _b.value;
|
|
32
|
-
}, [query.data]);
|
|
33
|
-
const showLink = useCallback((id) => {
|
|
34
|
-
if (curdView == null ? void 0 : curdView.routeShow) {
|
|
35
|
-
const toPath = compile(curdView == null ? void 0 : curdView.routeShow, { encode: encodeURIComponent });
|
|
36
|
-
return toPath({ id });
|
|
37
|
-
}
|
|
38
|
-
return "";
|
|
39
|
-
}, [curdView == null ? void 0 : curdView.routeShow]);
|
|
40
|
-
const openShow = useCallback((id) => {
|
|
41
|
-
if (showLink) {
|
|
42
|
-
router.push(showLink(id));
|
|
43
|
-
}
|
|
44
|
-
}, [router, showLink]);
|
|
45
|
-
const editLink = useCallback((id) => {
|
|
46
|
-
if (curdView == null ? void 0 : curdView.routeEdit) {
|
|
47
|
-
const toPath = compile(curdView == null ? void 0 : curdView.routeEdit, { encode: encodeURIComponent });
|
|
48
|
-
return toPath({ id });
|
|
49
|
-
}
|
|
50
|
-
return "";
|
|
51
|
-
}, [curdView == null ? void 0 : curdView.routeEdit]);
|
|
52
|
-
const createLink = useMemo(() => {
|
|
53
|
-
if (curdView == null ? void 0 : curdView.routeCreate) {
|
|
54
|
-
return (curdView == null ? void 0 : curdView.routeCreate) || "";
|
|
55
|
-
}
|
|
56
|
-
return "";
|
|
57
|
-
}, [curdView == null ? void 0 : curdView.routeCreate]);
|
|
58
|
-
useMemo(() => {
|
|
59
|
-
if (curdView == null ? void 0 : curdView.routeShow) {
|
|
60
|
-
const show = match(curdView.routeShow)(pathName);
|
|
61
|
-
if (show) {
|
|
62
|
-
setActivateId(show.params["id"]);
|
|
63
|
-
}
|
|
64
|
-
} else if (curdView == null ? void 0 : curdView.routeEdit) {
|
|
65
|
-
const matchEditObj = match(curdView.routeShow)(pathName);
|
|
66
|
-
if (matchEditObj) {
|
|
67
|
-
setActivateId(matchEditObj.params["id"]);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}, [curdView == null ? void 0 : curdView.routeEdit, curdView == null ? void 0 : curdView.routeShow, pathName, setActivateId]);
|
|
71
|
-
return {
|
|
72
|
-
curdView,
|
|
73
|
-
openShow,
|
|
74
|
-
// invalidateList,
|
|
75
|
-
// invalidateGet,
|
|
76
|
-
activateId,
|
|
77
|
-
setActivateId,
|
|
78
|
-
editLink,
|
|
79
|
-
createLink,
|
|
80
|
-
showLink
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export {
|
|
84
|
-
CurdViewView,
|
|
85
|
-
activateIdAtom,
|
|
86
|
-
curdStore,
|
|
87
|
-
curdViewAtom,
|
|
88
|
-
curdViewIdAtom,
|
|
89
|
-
useCurdView
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createPromiseClient } from "@connectrpc/connect";
|
|
2
|
-
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
3
|
-
import { MtmService } from "./gomtmpb/mtm/sppb/mtm_connect";
|
|
4
|
-
const mtmClient = createPromiseClient(
|
|
5
|
-
MtmService,
|
|
6
|
-
createConnectTransport({
|
|
7
|
-
baseUrl: "https://demo.connectrpc.com"
|
|
8
|
-
})
|
|
9
|
-
);
|
package/dist/esm/http/cors.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
|
|
2
|
-
type OriginFn = (origin: string | undefined, req: Request) => StaticOrigin | Promise<StaticOrigin>;
|
|
3
|
-
interface CorsOptions {
|
|
4
|
-
origin?: StaticOrigin | OriginFn;
|
|
5
|
-
methods?: string | string[];
|
|
6
|
-
allowedHeaders?: string | string[];
|
|
7
|
-
exposedHeaders?: string | string[];
|
|
8
|
-
credentials?: boolean;
|
|
9
|
-
maxAge?: number;
|
|
10
|
-
preflightContinue?: boolean;
|
|
11
|
-
optionsSuccessStatus?: number;
|
|
12
|
-
}
|
|
13
|
-
export default function cors(req: Request, res: Response, options?: CorsOptions): Promise<Response>;
|
|
14
|
-
export declare function initCors(options?: CorsOptions): (req: Request, res: Response) => Promise<Response>;
|
|
15
|
-
export {};
|
package/dist/esm/http/cors.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __async = (__this, __arguments, generator) => {
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
var fulfilled = (value) => {
|
|
20
|
-
try {
|
|
21
|
-
step(generator.next(value));
|
|
22
|
-
} catch (e) {
|
|
23
|
-
reject(e);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var rejected = (value) => {
|
|
27
|
-
try {
|
|
28
|
-
step(generator.throw(value));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
34
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
const defaultOptions = {
|
|
38
|
-
origin: "*",
|
|
39
|
-
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
|
40
|
-
preflightContinue: false,
|
|
41
|
-
optionsSuccessStatus: 204
|
|
42
|
-
};
|
|
43
|
-
function isOriginAllowed(origin, allowed) {
|
|
44
|
-
return Array.isArray(allowed) ? allowed.some((o) => isOriginAllowed(origin, o)) : typeof allowed === "string" ? origin === allowed : allowed instanceof RegExp ? allowed.test(origin) : !!allowed;
|
|
45
|
-
}
|
|
46
|
-
function getOriginHeaders(reqOrigin, origin) {
|
|
47
|
-
const headers = new Headers();
|
|
48
|
-
if (origin === "*") {
|
|
49
|
-
headers.set("Access-Control-Allow-Origin", "*");
|
|
50
|
-
} else if (typeof origin === "string") {
|
|
51
|
-
headers.set("Access-Control-Allow-Origin", origin);
|
|
52
|
-
headers.append("Vary", "Origin");
|
|
53
|
-
} else {
|
|
54
|
-
const allowed = isOriginAllowed(reqOrigin != null ? reqOrigin : "", origin);
|
|
55
|
-
if (allowed && reqOrigin) {
|
|
56
|
-
headers.set("Access-Control-Allow-Origin", reqOrigin);
|
|
57
|
-
}
|
|
58
|
-
headers.append("Vary", "Origin");
|
|
59
|
-
}
|
|
60
|
-
return headers;
|
|
61
|
-
}
|
|
62
|
-
function originHeadersFromReq(req, origin) {
|
|
63
|
-
return __async(this, null, function* () {
|
|
64
|
-
const reqOrigin = req.headers.get("Origin") || void 0;
|
|
65
|
-
const value = typeof origin === "function" ? yield origin(reqOrigin, req) : origin;
|
|
66
|
-
if (!value)
|
|
67
|
-
return;
|
|
68
|
-
return getOriginHeaders(reqOrigin, value);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function getAllowedHeaders(req, allowed) {
|
|
72
|
-
const headers = new Headers();
|
|
73
|
-
if (!allowed) {
|
|
74
|
-
allowed = req.headers.get("Access-Control-Request-Headers");
|
|
75
|
-
headers.append("Vary", "Access-Control-Request-Headers");
|
|
76
|
-
} else if (Array.isArray(allowed)) {
|
|
77
|
-
allowed = allowed.join(",");
|
|
78
|
-
}
|
|
79
|
-
if (allowed) {
|
|
80
|
-
headers.set("Access-Control-Allow-Headers", allowed);
|
|
81
|
-
}
|
|
82
|
-
return headers;
|
|
83
|
-
}
|
|
84
|
-
function cors(req, res, options) {
|
|
85
|
-
return __async(this, null, function* () {
|
|
86
|
-
var _a;
|
|
87
|
-
const opts = __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
88
|
-
const { headers } = res;
|
|
89
|
-
const originHeaders = yield originHeadersFromReq(req, (_a = opts.origin) != null ? _a : false);
|
|
90
|
-
const mergeHeaders = (v, k) => {
|
|
91
|
-
if (k === "Vary")
|
|
92
|
-
headers.append(k, v);
|
|
93
|
-
else
|
|
94
|
-
headers.set(k, v);
|
|
95
|
-
};
|
|
96
|
-
if (!originHeaders)
|
|
97
|
-
return res;
|
|
98
|
-
originHeaders.forEach(mergeHeaders);
|
|
99
|
-
if (opts.credentials) {
|
|
100
|
-
headers.set("Access-Control-Allow-Credentials", "true");
|
|
101
|
-
}
|
|
102
|
-
const exposed = Array.isArray(opts.exposedHeaders) ? opts.exposedHeaders.join(",") : opts.exposedHeaders;
|
|
103
|
-
if (exposed) {
|
|
104
|
-
headers.set("Access-Control-Expose-Headers", exposed);
|
|
105
|
-
}
|
|
106
|
-
if (req.method === "OPTIONS") {
|
|
107
|
-
if (opts.methods) {
|
|
108
|
-
const methods = Array.isArray(opts.methods) ? opts.methods.join(",") : opts.methods;
|
|
109
|
-
headers.set("Access-Control-Allow-Methods", methods);
|
|
110
|
-
}
|
|
111
|
-
getAllowedHeaders(req, opts.allowedHeaders).forEach(mergeHeaders);
|
|
112
|
-
if (typeof opts.maxAge === "number") {
|
|
113
|
-
headers.set("Access-Control-Max-Age", String(opts.maxAge));
|
|
114
|
-
}
|
|
115
|
-
if (opts.preflightContinue)
|
|
116
|
-
return res;
|
|
117
|
-
headers.set("Content-Length", "0");
|
|
118
|
-
return new Response(null, { status: opts.optionsSuccessStatus, headers });
|
|
119
|
-
}
|
|
120
|
-
return res;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function initCors(options) {
|
|
124
|
-
return (req, res) => cors(req, res, options);
|
|
125
|
-
}
|
|
126
|
-
export {
|
|
127
|
-
cors as default,
|
|
128
|
-
initCors
|
|
129
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createStore, Getter, SetStateAction, Setter, WritableAtom } from 'jotai';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
export declare function AtomsHydrator({ atomValues, store, children, }: {
|
|
4
|
-
atomValues: Iterable<readonly [WritableAtom<unknown, [any], unknown>, unknown]>;
|
|
5
|
-
store?: ReturnType<typeof createStore>;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}): ReactNode;
|
|
8
|
-
export default function atomWithDebounce<T>(initialValue: T, delayMilliseconds?: number, shouldDebounceOnReset?: boolean): {
|
|
9
|
-
currentValueAtom: import("jotai").Atom<T>;
|
|
10
|
-
isDebouncingAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
11
|
-
init: boolean;
|
|
12
|
-
};
|
|
13
|
-
clearTimeoutAtom: WritableAtom<null, [_arg: unknown], void> & {
|
|
14
|
-
init: null;
|
|
15
|
-
};
|
|
16
|
-
debouncedValueAtom: WritableAtom<T, [update: SetStateAction<T>], void> & {
|
|
17
|
-
init: T;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare function atomWithRefresh<T>(fn: (get: Getter) => T): WritableAtom<T, [], void>;
|
|
21
|
-
type Callback<Value> = (get: Getter, set: Setter, newVal: Value, prevVal: Value) => void;
|
|
22
|
-
export declare function atomWithListeners<Value>(initialValue: Value): readonly [WritableAtom<Value, [arg: SetStateAction<Value>], void>, (callback: Callback<Value>) => void];
|
|
23
|
-
export {};
|