diff --git a/comps/filter/parser/filter-where.ts b/comps/filter/parser/filter-where.ts index f68a10f..856aabb 100755 --- a/comps/filter/parser/filter-where.ts +++ b/comps/filter/parser/filter-where.ts @@ -1,14 +1,12 @@ import { GFCol, parseGenField } from "lib/gen/utils"; import { getFilter } from "../utils/get-filter"; import { parseSingleFilter } from "./single-filter"; -import { softDeleteFilter } from "./soft-delete-filter"; export const filterWhere = (filter_name: string, p: any) => { const f = getFilter(filter_name); let where: any = {}; if (f) { let fields: GFCol[] = []; - // if (p.gen__fields) { fields = parseGenField(p.gen__fields); } @@ -27,12 +25,5 @@ export const filterWhere = (filter_name: string, p: any) => { } } - if (p && p.opt__feature && p.sft__fields && p.sft__type) { - where = softDeleteFilter(where, { - feature: p.opt_feature, - field: p.sft__fields, - type: p.sft__type, - }); - } return where; }; diff --git a/comps/list/TableList.tsx b/comps/list/TableList.tsx index c827247..efdbc7f 100755 --- a/comps/list/TableList.tsx +++ b/comps/list/TableList.tsx @@ -175,6 +175,7 @@ export const TableList: FC = ({ }, collapsed: new Set(), cached_row: new WeakMap(), + filtering: "" as ReactNode | string | true, sort: { columns: (ls_sort?.columns || []) as SortColumn[], on_change: (cols: SortColumn[]) => { @@ -260,6 +261,7 @@ export const TableList: FC = ({ if (arg?.toast === false) should_toast = false; local.should_toast = should_toast; + local.filtering = ""; if (typeof on_load === "function") { local.status = "loading"; local.render(); @@ -267,6 +269,26 @@ export const TableList: FC = ({ const orderBy = local.sort.orderBy || undefined; const where = filterWhere(filter_name, __props); + if (where?.OR?.length > 0) { + const key = Object.keys(where.OR[0])[0]; + if (key && where.OR[0][key]) { + let filtering = where.OR[0][key].contains; + if (typeof local.filtering === "string") { + filtering = filtering.slice(1, -1); + } else { + filtering = ""; + } + + if (filtering) { + local.filtering = ( +
+ Searching for:
"{filtering.trim()}"
+
+ ); + } + } + } + if (md) { const last = md.params.links[md.params.links.length - 1]; if (last && last.where) { @@ -846,7 +868,21 @@ export const TableList: FC = ({
-
No Data
+
+ No Data +
+ {local.filtering && ( +
+ {local.filtering} +
+ )} +
), @@ -929,7 +965,21 @@ export const TableList: FC = ({ ) : (
-
No Data
+
+ No Data +
+ {local.filtering && ( +
+ {local.filtering} +
+ )} +
)}