Skip to content

Commit 4d75755

Browse files
committed
remove filter modal / table toolbar unnecessary code
1 parent 966c4df commit 4d75755

File tree

5 files changed

+60
-716
lines changed

5 files changed

+60
-716
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import styled from "styled-components";
2+
3+
export const ToolbarContainer = styled.div`
4+
padding: 12px;
5+
width: 100%;
6+
`;
7+
8+
export const ToolbarRow = styled.div`
9+
display: flex;
10+
align-items: center;
11+
justify-content: space-between;
12+
min-width: max-content;
13+
width: 100%;
14+
`;
15+
16+
export const ToolbarIcons = styled.div`
17+
display: flex;
18+
align-items: center;
19+
gap: 8px;
20+
`;
21+
22+

client/packages/lowcoder/src/comps/comps/tableLiteComp/tableComp.tsx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { tableDataRowExample } from "./column/tableColumnListComp";
22
import { getPageSize } from "./paginationControl";
33
import { TableCompView } from "./tableCompView";
4-
import { TableFilter } from "./tableToolbarComp";
54
import {
65
columnHide,
76
ColumnsAggrData,
@@ -313,27 +312,28 @@ export class TableImplComp extends TableInitComp {
313312
const nodes = {
314313
data: this.sortDataNode(),
315314
searchValue: this.children.searchText.node(),
316-
filter: this.children.toolbar.children.filter.node(),
317-
showFilter: this.children.toolbar.children.showFilter.node(),
318315
};
319316
let context = this;
317+
320318
const filteredDataNode = withFunction(fromRecord(nodes), (input) => {
321-
const { data, searchValue, filter, showFilter } = input;
322-
const filteredData = filterData(data, searchValue.value, filter, showFilter.value);
323-
// console.info("filterNode. data: ", data, " filter: ", filter, " filteredData: ", filteredData);
324-
// if data is changed on search then trigger event
325-
if(Boolean(searchValue.value) && data.length !== filteredData.length) {
319+
const { data, searchValue } = input;
320+
const filteredData = filterData(data, searchValue.value, { filters: [], stackType: "and" }, false);
321+
322+
if (Boolean(searchValue.value) && data.length !== filteredData.length) {
326323
const onEvent = context.children.onEvent.getView();
327324
setTimeout(() => {
328325
onEvent("dataSearch");
329326
});
330327
}
328+
331329
return filteredData.map((row) => tranToTableRecord(row, row[OB_ROW_ORI_INDEX]));
332330
});
331+
333332
return lastValueIfEqual(this, "filteredDataNode", [filteredDataNode, nodes] as const, (a, b) =>
334333
shallowEqual(a[1], b[1])
335334
)[0];
336335
}
336+
337337

338338
oriDisplayDataNode() {
339339
const nodes = {
@@ -494,7 +494,6 @@ export class TableImplComp extends TableInitComp {
494494
}
495495

496496
let TableTmpComp = withViewFn(TableImplComp, (comp) => {
497-
const [emptyRows, setEmptyRows] = useState([]);
498497
return (
499498
<HidableView hidden={comp.children.hidden.getView()}>
500499
<TableCompView
@@ -580,13 +579,14 @@ TableTmpComp = withMethodExposing(TableTmpComp, [
580579
params: [{ name: "filter", type: "JSON" }],
581580
},
582581
execute: (comp, values) => {
582+
//TODO: add filter maybe
583583
if (values[0]) {
584-
const param = values[0] as TableFilter;
585-
const currentVal = comp.children.toolbar.children.filter.getView();
586-
comp.children.toolbar.children.filter.dispatchChangeValueAction({
587-
...currentVal,
588-
...param,
589-
});
584+
// const param = values[0] as TableFilter;
585+
// const currentVal = comp.children.toolbar.children.filter.getView();
586+
// comp.children.toolbar.children.filter.dispatchChangeValueAction({
587+
// ...currentVal,
588+
// ...param,
589+
// });
590590
}
591591
},
592592
},
@@ -915,18 +915,6 @@ export const TableLiteComp = withExposingConfigs(TableTmpComp, [
915915
},
916916
trans("table.displayDataDesc")
917917
),
918-
new DepsConfig(
919-
"filter",
920-
(children) => {
921-
return {
922-
filter: children.toolbar.children.filter.node(),
923-
};
924-
},
925-
(input) => {
926-
return input.filter;
927-
},
928-
trans("table.filterDesc")
929-
),
930918
new DepsConfig(
931919
"selectedCell",
932920
(children) => {

client/packages/lowcoder/src/comps/comps/tableLiteComp/tableCompView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,9 @@ export const TableCompView = React.memo((props: {
804804
onRefresh: (allQueryNames: Array<string>, setLoading: (loading: boolean) => void) => void;
805805
onDownload: (fileName: string) => void;
806806
}) => {
807+
808+
console.log("TableCompView");
809+
807810
const editorState = useContext(EditorContext);
808811
const currentTheme = useContext(ThemeContext)?.theme;
809812
const showDataLoadingIndicators = currentTheme?.showDataLoadingIndicators;
@@ -918,7 +921,6 @@ export const TableCompView = React.memo((props: {
918921
const toolbarView = !hideToolbar && (
919922
<TableToolbar
920923
toolbar={toolbar}
921-
$style={toolbarStyle}
922924
pagination={{
923925
...pagination,
924926
total: pageDataInfo.total,

0 commit comments

Comments
 (0)