mtxuilib 0.0.358 → 0.0.360
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/connectes/ConnectEs.cjs +64 -11
- package/dist/esm/connectes/ConnectEs.d.ts +12 -6
- package/dist/esm/connectes/ConnectEs.js +1 -1
- package/dist/esm/ui/ui-mt/input-field/RichEditorInput.js +1 -1
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/dist/ui/ui-mt/input-field/RichEditorInput.cjs +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
7
36
|
var __export = (target, all) => {
|
|
8
37
|
for (var name in all)
|
|
9
38
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -19,25 +48,49 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
48
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
49
|
var ConnectEs_exports = {};
|
|
21
50
|
__export(ConnectEs_exports, {
|
|
22
|
-
|
|
51
|
+
ConnectEsUpdateForm: () => ConnectEsUpdateForm,
|
|
52
|
+
FormInner: () => FormInner,
|
|
53
|
+
FormInnerWithSuspenseQuery: () => FormInnerWithSuspenseQuery
|
|
23
54
|
});
|
|
24
55
|
module.exports = __toCommonJS(ConnectEs_exports);
|
|
25
56
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
57
|
var import_react = require("react");
|
|
27
58
|
var import_connectquery = require("./connectquery");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
59
|
+
var import_react_hook_form = require("react-hook-form");
|
|
60
|
+
function ConnectEsUpdateForm(props) {
|
|
61
|
+
const { defaultValues, methodQuerySig, params, children, mutationMethodSig } = props;
|
|
62
|
+
const mutation = (0, import_connectquery.useMutation)(mutationMethodSig);
|
|
63
|
+
const handleSubmit = (values) => {
|
|
64
|
+
mutation.mutateAsync(values);
|
|
65
|
+
};
|
|
66
|
+
if (!defaultValues) {
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "ConnectEsUpdateForm loading" }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
FormInnerWithSuspenseQuery,
|
|
69
|
+
{
|
|
70
|
+
methodQuerySig,
|
|
71
|
+
params,
|
|
72
|
+
onSubmit: handleSubmit,
|
|
73
|
+
children
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
32
76
|
}
|
|
33
|
-
return
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormInner, { defaultValues, onSubmit: handleSubmit, children });
|
|
78
|
+
}
|
|
79
|
+
function FormInner(props) {
|
|
80
|
+
const { defaultValues, onSubmit, children } = props;
|
|
81
|
+
const form = (0, import_react_hook_form.useForm)({
|
|
82
|
+
defaultValues
|
|
83
|
+
});
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_hook_form.FormProvider, __spreadProps(__spreadValues({}, form), { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { onSubmit: form.handleSubmit(onSubmit), children }) }));
|
|
34
85
|
}
|
|
35
|
-
function
|
|
36
|
-
const {
|
|
37
|
-
const query = (0, import_connectquery.useSuspenseQuery)(
|
|
38
|
-
return
|
|
86
|
+
function FormInnerWithSuspenseQuery(props) {
|
|
87
|
+
const _a = props, { methodQuerySig, params, onSubmit } = _a, etc = __objRest(_a, ["methodQuerySig", "params", "onSubmit"]);
|
|
88
|
+
const query = (0, import_connectquery.useSuspenseQuery)(methodQuerySig, params);
|
|
89
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormInner, __spreadValues({ defaultValues: query.data, onSubmit }, etc));
|
|
39
90
|
}
|
|
40
91
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
92
|
0 && (module.exports = {
|
|
42
|
-
|
|
93
|
+
ConnectEsUpdateForm,
|
|
94
|
+
FormInner,
|
|
95
|
+
FormInnerWithSuspenseQuery
|
|
43
96
|
});
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentProps, PropsWithChildren } from "react";
|
|
2
2
|
import { MethodUnaryDescriptor } from "./connectquery";
|
|
3
3
|
import type { Message, PartialMessage } from "@bufbuild/protobuf";
|
|
4
|
-
export declare function
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare function ConnectEsUpdateForm<I extends Message<I>, O extends Message<O>>(props: {
|
|
5
|
+
defaultValues?: any;
|
|
6
|
+
mutationMethodSig: MethodUnaryDescriptor<any, any>;
|
|
7
|
+
} & Omit<ComponentProps<typeof FormInnerWithSuspenseQuery>, "onSubmit">): import("react").JSX.Element;
|
|
8
|
+
export declare function FormInner(props: {
|
|
9
|
+
defaultValues: any;
|
|
10
|
+
onSubmit: (values: any) => void;
|
|
11
|
+
} & PropsWithChildren): import("react").JSX.Element;
|
|
12
|
+
export declare function FormInnerWithSuspenseQuery<I extends Message<I>, O extends Message<O>>(props: {
|
|
13
|
+
methodQuerySig: MethodUnaryDescriptor<I, O>;
|
|
7
14
|
params: PartialMessage<I>;
|
|
8
|
-
|
|
9
|
-
}): import("react").JSX.Element;
|
|
15
|
+
} & Omit<ComponentProps<typeof FormInner>, "defaultValues">): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";var b=Object.defineProperty,g=Object.defineProperties;var M=Object.getOwnPropertyDescriptors;var a=Object.getOwnPropertySymbols;var l=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var p=(e,t,o)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,m=(e,t)=>{for(var o in t||(t={}))l.call(t,o)&&p(e,o,t[o]);if(a)for(var o of a(t))f.call(t,o)&&p(e,o,t[o]);return e},y=(e,t)=>g(e,M(t));var S=(e,t)=>{var o={};for(var n in e)l.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&a)for(var n of a(e))t.indexOf(n)<0&&f.call(e,n)&&(o[n]=e[n]);return o};import{Fragment as O,jsx as s}from"react/jsx-runtime";import{Suspense as I}from"react";import{useMutation as F,useSuspenseQuery as P}from"./connectquery";import{FormProvider as Q,useForm as V}from"react-hook-form";function q(e){const{defaultValues:t,methodQuerySig:o,params:n,children:r,mutationMethodSig:i}=e,u=F(i),d=h=>{u.mutateAsync(h)};return t?s(c,{defaultValues:t,onSubmit:d,children:r}):s(I,{fallback:s(O,{children:"ConnectEsUpdateForm loading"}),children:s(C,{methodQuerySig:o,params:n,onSubmit:d,children:r})})}function c(e){const{defaultValues:t,onSubmit:o,children:n}=e,r=V({defaultValues:t});return s(Q,y(m({},r),{children:s("form",{onSubmit:r.handleSubmit(o),children:n})}))}function C(e){const u=e,{methodQuerySig:t,params:o,onSubmit:n}=u,r=S(u,["methodQuerySig","params","onSubmit"]),i=P(t,o);return s(c,m({defaultValues:i.data,onSubmit:n},r))}export{q as ConnectEsUpdateForm,c as FormInner,C as FormInnerWithSuspenseQuery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as l,jsx as r}from"react/jsx-runtime";import{useMemo as i}from"react";import{useFormContext as u}from"react-hook-form";import{TailwindAdvancedEditor as p}from"../../novel/tailwind/advanced-editor";import{convertEditorHTMLToJson as a,convertEditorJsonToHTML as T}from"../../novel/tailwind/utils";const M=s=>{const{name:n,contentType:o}=s,e=u(),c=i(()=>{const t=e.getValues()[n];return o=="html"?a(t):t},[o,e,n]);return r(l,{children:r(p,{content:c,onValueChange:t=>{const m=T(t);e.setValue("content",m)}})})};export{M as RichTextInput};
|
|
1
|
+
import{Fragment as l,jsx as r}from"react/jsx-runtime";import{useMemo as i}from"react";import{useFormContext as u}from"react-hook-form";import{TailwindAdvancedEditor as p}from"../../novel/tailwind/advanced-editor";import{convertEditorHTMLToJson as a,convertEditorJsonToHTML as T}from"../../novel/tailwind/utils";const M=s=>{const{name:n,contentType:o}=s,e=u(),c=i(()=>{const t=e.getValues()[n];return o=="html"&&t?a(t):t},[o,e,n]);return r(l,{children:r(p,{content:c,onValueChange:t=>{const m=T(t);e.setValue("content",m)}})})};export{M as RichTextInput};
|