MCPcopy Create free account
hub / github.com/VienLi/CcView / genQueryRow

Function genQueryRow

src/components/Query/QueryFactory.tsx:16–44  ·  view source on GitHub ↗
(eventMap: Record<string, Function>, rowList : QueryItem[], query: Record<string, any>, setQuery: (newQuery: any) => void, key: string)

Source from the content-addressed store, hash-verified

14});
15// 生成每一行
16function genQueryRow(eventMap: Record<string, Function>, rowList : QueryItem[], query: Record<string, any>, setQuery: (newQuery: any) => void, key: string) {
17 const rowElement = rowList.map((queryItem, index) => {
18 const { type, className = '', mapping = {}, properties } = queryItem;
19 const { key } = mapping;
20 const value = get(query, key, undefined);
21 const handlerChange = (newValue: any) => {
22 if (key) {
23 const newQuery = {
24 ...query,
25 [key]: newValue,
26 page: 0
27 };
28 setQuery?.(newQuery);
29 }
30 };
31 return (
32 <div key={`${type}-${index}`} className={`${className} shrink-0 mb-4`}>
33 <ItemComponent is={queryItem.type} {...{ ...properties, value, onChange: handlerChange, eventMap }} ></ItemComponent>
34 </div>
35 );
36 });
37 return (
38 <div key={key} className={`w-full shrink-0 flex flex-row flex-wrap justify-start items-center`}>
39 {
40 rowElement
41 }
42 </div>
43 );
44}
45
46export default function TableQuery(props: TableQueryProp) {
47 const { query = {}, config, setQuery, eventMap = {}} = props;

Callers 1

TableQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected