gomtm 0.0.175 → 0.0.178
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.
|
@@ -9,14 +9,15 @@ import { curdActivateIdAtom } from "../../curd/CurdListView";
|
|
|
9
9
|
import { BlogPostItemActions } from "./BlogPostActions";
|
|
10
10
|
const PostCard = (props) => {
|
|
11
11
|
const { item } = props;
|
|
12
|
-
const debug = useDebug;
|
|
12
|
+
const debug = useDebug();
|
|
13
13
|
const [curdActivateId, setcurdActivateId] = useAtom(curdActivateIdAtom);
|
|
14
14
|
return /* @__PURE__ */ jsxs(
|
|
15
15
|
Card,
|
|
16
16
|
{
|
|
17
17
|
className: cn(
|
|
18
18
|
"w-[350px]",
|
|
19
|
-
item.id == curdActivateId && "bg-red-300 p-2"
|
|
19
|
+
item.id == curdActivateId && "bg-red-300 p-2",
|
|
20
|
+
debug.isDebug && "bg-blue-300"
|
|
20
21
|
),
|
|
21
22
|
onClick: () => {
|
|
22
23
|
setcurdActivateId(item.id);
|
|
@@ -0,0 +1,14 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,44 @@
|
|
|
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 "../components/formFieldRender/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,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useContext, useState } from "react";
|
|
4
|
-
import { createStore } from "jotai";
|
|
4
|
+
import { createStore, useAtom } from "jotai";
|
|
5
5
|
import { getCookie } from "mtxlib/clientlib";
|
|
6
|
+
import { isDebugAtom } from "mtxuilib/store/app.atoms";
|
|
7
|
+
import { useHotkeys } from "react-hotkeys-hook";
|
|
6
8
|
import { ExtKey_Hostname, ExtKey_SelfBackend, ExtKey_mtmaccessToken, ExtKey_mtmbackend, MtM_TOKEN_NAME } from "../consts";
|
|
7
9
|
import { MtConnectProvider } from "./MtConnectProvider";
|
|
8
10
|
import { MtReactQueryProvider } from "./ReactQueryProvider";
|
|
@@ -10,6 +12,10 @@ const mtmAppStore = createStore();
|
|
|
10
12
|
const AppContext = createContext(void 0);
|
|
11
13
|
function GomtmProvider(props) {
|
|
12
14
|
const { children } = props;
|
|
15
|
+
const [isDebug, setDebug] = useAtom(isDebugAtom);
|
|
16
|
+
useHotkeys("alt+j", () => {
|
|
17
|
+
setDebug(!isDebug);
|
|
18
|
+
}, []);
|
|
13
19
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MtConnectProvider, { children: /* @__PURE__ */ jsx(MtReactQueryProvider, { children }) }) });
|
|
14
20
|
}
|
|
15
21
|
function useMtmApp() {
|