fix
This commit is contained in:
parent
72c85b75d0
commit
a1ab7bc734
|
|
@ -135,6 +135,7 @@ export const Field: FC<FieldProp> = (arg) => {
|
||||||
className={cx(
|
className={cx(
|
||||||
"field",
|
"field",
|
||||||
field.type,
|
field.type,
|
||||||
|
name,
|
||||||
sub_type,
|
sub_type,
|
||||||
"c-flex c-relative",
|
"c-flex c-relative",
|
||||||
editorClassName,
|
editorClassName,
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,8 @@ export const FieldTypeInput: FC<{
|
||||||
prop.onChange(fm.data[field.name]);
|
prop.onChange(fm.data[field.name]);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
//@ts-ignore
|
||||||
|
inputmode="decimal"
|
||||||
value={format(value, {
|
value={format(value, {
|
||||||
mask: "____-____-_______",
|
mask: "____-____-_______",
|
||||||
replacement: { _: /\d/ },
|
replacement: { _: /\d/ },
|
||||||
|
|
@ -276,6 +278,8 @@ export const FieldTypeInput: FC<{
|
||||||
<div className="c-flex c-relative c-flex-1">
|
<div className="c-flex c-relative c-flex-1">
|
||||||
<InputMask
|
<InputMask
|
||||||
mask={mask}
|
mask={mask}
|
||||||
|
//@ts-ignore
|
||||||
|
inputmode="decimal"
|
||||||
replacement={{ _: /\d/ }}
|
replacement={{ _: /\d/ }}
|
||||||
onChange={(ev) => {
|
onChange={(ev) => {
|
||||||
fm.data[field.name] = ev.currentTarget.value.replace(/\D/g, "");
|
fm.data[field.name] = ev.currentTarget.value.replace(/\D/g, "");
|
||||||
|
|
|
||||||
|
|
@ -269,8 +269,6 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
|
||||||
fm.render();
|
fm.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.clear();
|
|
||||||
|
|
||||||
if (fm.props.sonar === "on" && !isEditor) {
|
if (fm.props.sonar === "on" && !isEditor) {
|
||||||
toast.dismiss();
|
toast.dismiss();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ export { prasi_gen } from "./gen/prasi_gen";
|
||||||
export { guessLabel } from "./utils/guess-label";
|
export { guessLabel } from "./utils/guess-label";
|
||||||
import __get from "lodash.get";
|
import __get from "lodash.get";
|
||||||
import { sum } from "./utils/sum";
|
import { sum } from "./utils/sum";
|
||||||
|
export { _post } from "./utils/post";
|
||||||
export { toast, Toaster } from "./comps/ui/toast";
|
export { toast, Toaster } from "./comps/ui/toast";
|
||||||
export { NavLink } from "./comps/popup/NavLink";
|
export { NavLink } from "./comps/popup/NavLink";
|
||||||
export { kvToJSON } from "./utils/kv-to-json";
|
export { kvToJSON } from "./utils/kv-to-json";
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,23 @@
|
||||||
/// <reference types="bun-types" />
|
/// <reference types="bun-types" />
|
||||||
|
|
||||||
|
type ServerArg = {
|
||||||
|
req: Request;
|
||||||
|
handle: (req: Request) => Promise<Response>;
|
||||||
|
mode: "dev" | "prod";
|
||||||
|
url: {
|
||||||
|
raw: URL;
|
||||||
|
pathname: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
type ServerSession = {
|
type ServerSession = {
|
||||||
handle: (arg: {
|
handle: (arg: ServerArg) => Promise<Response>;
|
||||||
req: Request;
|
|
||||||
handle: (req: Request) => Promise<Response>;
|
|
||||||
mode: "dev" | "prod";
|
|
||||||
url: {
|
|
||||||
raw: URL;
|
|
||||||
pathname: string;
|
|
||||||
};
|
|
||||||
}) => Promise<Response>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sessionServer = <T>(arg: {
|
export const sessionServer = <T>(arg: {
|
||||||
encrypt?: boolean;
|
encrypt?: boolean;
|
||||||
|
router?: (
|
||||||
|
arg: ServerArg & { session: {} }
|
||||||
|
) => Response | (() => Promise<Response | void>) | void;
|
||||||
on: {
|
on: {
|
||||||
login: (arg: {
|
login: (arg: {
|
||||||
mode: "user-pass";
|
mode: "user-pass";
|
||||||
|
|
@ -23,9 +27,19 @@ export const sessionServer = <T>(arg: {
|
||||||
};
|
};
|
||||||
}): ServerSession => {
|
}): ServerSession => {
|
||||||
const s: ServerSession = {
|
const s: ServerSession = {
|
||||||
async handle({ req, handle, mode, url }) {
|
async handle(server_arg) {
|
||||||
if (url.pathname.startsWith("/_session")) {
|
const { req, handle, mode, url } = server_arg;
|
||||||
return new Response("marjio");
|
if (typeof arg.router === "function") {
|
||||||
|
let result = arg.router({
|
||||||
|
...server_arg,
|
||||||
|
session: {},
|
||||||
|
});
|
||||||
|
if (result && typeof result === "function") {
|
||||||
|
result = await result();
|
||||||
|
}
|
||||||
|
if (result instanceof Response) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await handle(req);
|
return await handle(req);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
export const _post = async (
|
||||||
|
path: string,
|
||||||
|
data: any,
|
||||||
|
arg?: { mode: "auto" | "always-prod" }
|
||||||
|
) => {
|
||||||
|
const final_path = path.startsWith("/") ? path : `/${path}`;
|
||||||
|
|
||||||
|
let _url = baseurl(final_path);
|
||||||
|
|
||||||
|
if (
|
||||||
|
location.hostname === "prasi.avolut.com" ||
|
||||||
|
location.host === "localhost:4550"
|
||||||
|
) {
|
||||||
|
if (arg?.mode === "always-prod") {
|
||||||
|
const newurl = new URL(location.href);
|
||||||
|
newurl.pathname = `/_proxy/${_url}`;
|
||||||
|
_url = newurl.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await fetch(_url, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
});
|
||||||
|
return await res.json();
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue