wip fix
This commit is contained in:
parent
6d05d76522
commit
6c17b8711d
|
|
@ -10,6 +10,7 @@ type TableListProp = {
|
|||
PassProp: any;
|
||||
name: string;
|
||||
on_load: () => Promise<any[]>;
|
||||
mode: "table" | "list" | "grid";
|
||||
};
|
||||
|
||||
export const TableList: FC<TableListProp> = ({
|
||||
|
|
@ -17,6 +18,7 @@ export const TableList: FC<TableListProp> = ({
|
|||
on_load,
|
||||
child,
|
||||
PassProp,
|
||||
mode,
|
||||
}) => {
|
||||
const local = useLocal({
|
||||
el: null as null | HTMLDivElement,
|
||||
|
|
@ -50,11 +52,20 @@ export const TableList: FC<TableListProp> = ({
|
|||
}
|
||||
}, [on_load]);
|
||||
|
||||
const childs = get(
|
||||
const raw_childs = get(
|
||||
child,
|
||||
"props.meta.item.component.props.child.content.childs"
|
||||
);
|
||||
|
||||
let childs: any[] = [];
|
||||
|
||||
const mode_child = raw_childs.find((e: any) => e.name === mode);
|
||||
|
||||
if (mode_child && mode_child.childs) {
|
||||
childs = mode_child.childs;
|
||||
}
|
||||
console.log(raw_childs);
|
||||
|
||||
const columns: ColumnOrColumnGroup<any>[] = [];
|
||||
for (const child of childs) {
|
||||
const key = getProp(child, "name");
|
||||
|
|
|
|||
|
|
@ -53,6 +53,13 @@ export const gen_table_list = (
|
|||
|
||||
if (data["child"]) {
|
||||
result["child"] = data["child"];
|
||||
|
||||
result["child"].content.childs = result["child"].content.childs.filter(
|
||||
(e: any) => {
|
||||
return e.name !== arg.mode;
|
||||
}
|
||||
);
|
||||
|
||||
result["child"].content.childs = [
|
||||
createItem({
|
||||
name: arg.mode,
|
||||
|
|
@ -67,9 +74,9 @@ export const gen_table_list = (
|
|||
},
|
||||
],
|
||||
}),
|
||||
...result["child"].content.childs,
|
||||
];
|
||||
}
|
||||
console.log(result["child"]);
|
||||
|
||||
if (data["selected"]) {
|
||||
result["selected"] = data["selected"];
|
||||
|
|
|
|||
Loading…
Reference in New Issue