diff --git a/comps/list/TableList.tsx b/comps/list/TableList.tsx index 56969c9..b5b98c5 100755 --- a/comps/list/TableList.tsx +++ b/comps/list/TableList.tsx @@ -89,7 +89,7 @@ export const TableList: FC = ({ on_load, child, PassProp, - mode, + mode: _mode, on_init, _item, gen_fields, @@ -106,6 +106,7 @@ export const TableList: FC = ({ __props, md, }) => { + let mode = _mode; if (mode === "auto") { if (w.isMobile) { mode = "list"; @@ -113,6 +114,7 @@ export const TableList: FC = ({ mode = "table"; } } + let ls_sort = localStorage.getItem( `sort-${location.pathname}-${location.hash}-${name}` ) as unknown as { columns: any; orderBy: any }; @@ -302,14 +304,14 @@ export const TableList: FC = ({ ); let childs: any[] = []; - let sub_name = ["fields"]; + let sub_name: string[] = []; switch (mode) { case "table": sub_name = ["tbl-col", "table: columns"]; break; case "list": - sub_name = ["list-row", "list: rows"]; + sub_name = ["list-row", "list: fields"]; break; } @@ -567,6 +569,18 @@ export const TableList: FC = ({ } let data = local.data || []; + + if (isEditor) { + if (data.length > 0) { + w.prasi_table_list_temp_data = data; + } else if ( + w.prasi_table_list_temp_data && + w.prasi_table_list_temp_data.length > 0 + ) { + data = w.prasi_table_list_temp_data; + } + } + if (id_parent && local.pk && local.sort.columns.length === 0) { data = sortTree(local.data, id_parent, local.pk.name); } @@ -753,7 +767,7 @@ export const TableList: FC = ({ data.map((e, idx) => { return (
{ if (!isEditor && typeof row_click === "function") { row_click({ @@ -766,7 +780,7 @@ export const TableList: FC = ({ }} > - {child} + {mode_child}
); diff --git a/comps/md/gen/gen-table-list.ts b/comps/md/gen/gen-table-list.ts index 702ed49..19a056a 100755 --- a/comps/md/gen/gen-table-list.ts +++ b/comps/md/gen/gen-table-list.ts @@ -79,17 +79,15 @@ export const generateTableList = async ( name: e.name, title: formatName(e.name), child: createItem({ - childs: [ - createItem({ - name: "cell", - padding: { - l: 8, - b: 0, - t: 0, - r: 8, - }, - adv: { - js: `\ + name: "cell", + padding: { + l: 8, + b: 0, + t: 0, + r: 8, + }, + adv: { + js: `\
${ arg.mode === "list" @@ -97,12 +95,10 @@ ${ : `` }
`, - jsBuilt: `\ + jsBuilt: `\ render(React.createElement("div", Object.assign({}, props, { className: cx(props.className, "") }),React.createElement(FormatValue, { value: col.value, name: col.name, gen_fields: gen__fields, ${tree_depth_built} }))); `, - }, - }), - ], + }, }), }, }, diff --git a/comps/md/gen/mode-table-list.ts b/comps/md/gen/mode-table-list.ts index 988cf12..cd97662 100755 --- a/comps/md/gen/mode-table-list.ts +++ b/comps/md/gen/mode-table-list.ts @@ -5,7 +5,7 @@ export const modeTableList = (mode: string) => { sub_name = "table: columns"; break; case "list": - sub_name = "list: rows"; + sub_name = "list: fields"; break; } return sub_name;