This commit is contained in:
Rizky 2024-06-24 21:15:34 -07:00
parent ae7c35b871
commit eb4d36c730
5 changed files with 11 additions and 7 deletions

View File

@ -1,11 +1,10 @@
import { useLocal } from "@/utils/use-local";
import { FC, ReactNode, useEffect } from "react";
import { FC, ReactNode } from "react";
import { createPortal } from "react-dom";
import { GenField } from "../form/typings";
import { default_filter_local, filter_window } from "./utils/types";
import { FilterContent } from "./FilterContent";
import { getPathname } from "lib/utils/pathname";
import { getFilter } from "./utils/get-filter";
import { default_filter_local } from "./utils/types";
type FilterMode = "regular" | "inline" | "popup";

View File

@ -40,6 +40,7 @@ async (opt) => {
raw_id = md.selected[pk];
}
}
if (parseInt(raw_id)) raw_id = parseInt(raw_id);
${opt?.before_load ? opt.before_load : `let id = raw_id`}
let item = {};

View File

@ -211,7 +211,7 @@ export const TableList: FC<TableListProp> = ({
const orderBy = local.sort.orderBy || undefined;
const where = filterWhere(filter_name, __props);
call_prasi_events("tablelist", "where", [where]);
call_prasi_events("tablelist", "where", [__props?.gen__table, where]);
const load_args: any = {
async reload() {},
@ -327,7 +327,7 @@ export const TableList: FC<TableListProp> = ({
);
if (mode_child) {
const tbl = _item.edit.childs[0].edit.childs.find(
(e) => get(e, "id") === mode_child.id
(e: any) => get(e, "id") === mode_child.id
);
const meta = tbl;
if (meta && meta.childs) {
@ -830,7 +830,7 @@ function isAtBottom({ currentTarget }: React.UIEvent<HTMLDivElement>): boolean {
);
}
function getProp(child: IItem, name: string, defaultValue?: any) {
function getProp(child: any, name: string, defaultValue?: any) {
const fn = new Function(
`return ${get(child, `component.props.${name}.valueBuilt`) || `null`}`
);

View File

@ -40,6 +40,7 @@ async (opt) => {
raw_id = md.selected[pk];
}
}
if (parseInt(raw_id)) raw_id = parseInt(raw_id);
${
opt?.before_load

View File

@ -1,4 +1,5 @@
import { FMLocal } from "../..";
import { Prisma } from "../../typings/prisma";
const events = {
form: {
@ -10,7 +11,9 @@ const events = {
before_load: async (fm: FMLocal) => {},
after_load: async (fm: FMLocal) => {},
},
tablelist: { where: async (where: any) => {} },
tablelist: {
where: async <T extends Prisma.ModelName>(table: T, where: any) => {},
},
};
let w = null as any;