|
1 | 1 | import { tableDataRowExample } from "./column/tableColumnListComp";
|
2 | 2 | import { getPageSize } from "./paginationControl";
|
3 | 3 | import { TableCompView } from "./tableCompView";
|
4 |
| -import { TableFilter } from "./tableToolbarComp"; |
5 | 4 | import {
|
6 | 5 | columnHide,
|
7 | 6 | ColumnsAggrData,
|
@@ -313,27 +312,28 @@ export class TableImplComp extends TableInitComp {
|
313 | 312 | const nodes = {
|
314 | 313 | data: this.sortDataNode(),
|
315 | 314 | searchValue: this.children.searchText.node(),
|
316 |
| - filter: this.children.toolbar.children.filter.node(), |
317 |
| - showFilter: this.children.toolbar.children.showFilter.node(), |
318 | 315 | };
|
319 | 316 | let context = this;
|
| 317 | + |
320 | 318 | 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) { |
326 | 323 | const onEvent = context.children.onEvent.getView();
|
327 | 324 | setTimeout(() => {
|
328 | 325 | onEvent("dataSearch");
|
329 | 326 | });
|
330 | 327 | }
|
| 328 | + |
331 | 329 | return filteredData.map((row) => tranToTableRecord(row, row[OB_ROW_ORI_INDEX]));
|
332 | 330 | });
|
| 331 | + |
333 | 332 | return lastValueIfEqual(this, "filteredDataNode", [filteredDataNode, nodes] as const, (a, b) =>
|
334 | 333 | shallowEqual(a[1], b[1])
|
335 | 334 | )[0];
|
336 | 335 | }
|
| 336 | + |
337 | 337 |
|
338 | 338 | oriDisplayDataNode() {
|
339 | 339 | const nodes = {
|
@@ -494,7 +494,6 @@ export class TableImplComp extends TableInitComp {
|
494 | 494 | }
|
495 | 495 |
|
496 | 496 | let TableTmpComp = withViewFn(TableImplComp, (comp) => {
|
497 |
| - const [emptyRows, setEmptyRows] = useState([]); |
498 | 497 | return (
|
499 | 498 | <HidableView hidden={comp.children.hidden.getView()}>
|
500 | 499 | <TableCompView
|
@@ -580,13 +579,14 @@ TableTmpComp = withMethodExposing(TableTmpComp, [
|
580 | 579 | params: [{ name: "filter", type: "JSON" }],
|
581 | 580 | },
|
582 | 581 | execute: (comp, values) => {
|
| 582 | + //TODO: add filter maybe |
583 | 583 | 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 | + // }); |
590 | 590 | }
|
591 | 591 | },
|
592 | 592 | },
|
@@ -915,18 +915,6 @@ export const TableLiteComp = withExposingConfigs(TableTmpComp, [
|
915 | 915 | },
|
916 | 916 | trans("table.displayDataDesc")
|
917 | 917 | ),
|
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 |
| - ), |
930 | 918 | new DepsConfig(
|
931 | 919 | "selectedCell",
|
932 | 920 | (children) => {
|
|
0 commit comments