fix
This commit is contained in:
parent
72c85b75d0
commit
a1ab7bc734
|
|
@ -135,6 +135,7 @@ export const Field: FC<FieldProp> = (arg) => {
|
|||
className={cx(
|
||||
"field",
|
||||
field.type,
|
||||
name,
|
||||
sub_type,
|
||||
"c-flex c-relative",
|
||||
editorClassName,
|
||||
|
|
|
|||
|
|
@ -246,6 +246,8 @@ export const FieldTypeInput: FC<{
|
|||
prop.onChange(fm.data[field.name]);
|
||||
}
|
||||
}}
|
||||
//@ts-ignore
|
||||
inputmode="decimal"
|
||||
value={format(value, {
|
||||
mask: "____-____-_______",
|
||||
replacement: { _: /\d/ },
|
||||
|
|
@ -276,6 +278,8 @@ export const FieldTypeInput: FC<{
|
|||
<div className="c-flex c-relative c-flex-1">
|
||||
<InputMask
|
||||
mask={mask}
|
||||
//@ts-ignore
|
||||
inputmode="decimal"
|
||||
replacement={{ _: /\d/ }}
|
||||
onChange={(ev) => {
|
||||
fm.data[field.name] = ev.currentTarget.value.replace(/\D/g, "");
|
||||
|
|
|
|||
|
|
@ -269,8 +269,6 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
|
|||
fm.render();
|
||||
}
|
||||
|
||||
console.clear();
|
||||
|
||||
if (fm.props.sonar === "on" && !isEditor) {
|
||||
toast.dismiss();
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ export { prasi_gen } from "./gen/prasi_gen";
|
|||
export { guessLabel } from "./utils/guess-label";
|
||||
import __get from "lodash.get";
|
||||
import { sum } from "./utils/sum";
|
||||
export { _post } from "./utils/post";
|
||||
export { toast, Toaster } from "./comps/ui/toast";
|
||||
export { NavLink } from "./comps/popup/NavLink";
|
||||
export { kvToJSON } from "./utils/kv-to-json";
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
/// <reference types="bun-types" />
|
||||
|
||||
type ServerArg = {
|
||||
req: Request;
|
||||
handle: (req: Request) => Promise<Response>;
|
||||
mode: "dev" | "prod";
|
||||
url: {
|
||||
raw: URL;
|
||||
pathname: string;
|
||||
};
|
||||
};
|
||||
type ServerSession = {
|
||||
handle: (arg: {
|
||||
req: Request;
|
||||
handle: (req: Request) => Promise<Response>;
|
||||
mode: "dev" | "prod";
|
||||
url: {
|
||||
raw: URL;
|
||||
pathname: string;
|
||||
};
|
||||
}) => Promise<Response>;
|
||||
handle: (arg: ServerArg) => Promise<Response>;
|
||||
};
|
||||
|
||||
export const sessionServer = <T>(arg: {
|
||||
encrypt?: boolean;
|
||||
router?: (
|
||||
arg: ServerArg & { session: {} }
|
||||
) => Response | (() => Promise<Response | void>) | void;
|
||||
on: {
|
||||
login: (arg: {
|
||||
mode: "user-pass";
|
||||
|
|
@ -23,9 +27,19 @@ export const sessionServer = <T>(arg: {
|
|||
};
|
||||
}): ServerSession => {
|
||||
const s: ServerSession = {
|
||||
async handle({ req, handle, mode, url }) {
|
||||
if (url.pathname.startsWith("/_session")) {
|
||||
return new Response("marjio");
|
||||
async handle(server_arg) {
|
||||
const { req, handle, mode, url } = server_arg;
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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