@fe-free/core 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @fe-free/core
2
2
 
3
+ ## 1.5.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: crud search
8
+ - @fe-free/tool@1.5.2
9
+
3
10
  ## 1.5.1
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -36,7 +36,7 @@
36
36
  "react-syntax-highlighter": "^15.5.0",
37
37
  "vanilla-jsoneditor": "^0.23.1",
38
38
  "zustand": "^4.5.4",
39
- "@fe-free/tool": "1.5.1"
39
+ "@fe-free/tool": "1.5.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@ant-design/pro-components": "^2.8.7",
@@ -101,6 +101,8 @@ function CRUDOfSimpleComponent(props: CRUDOfSimpleProps, ref: React.ForwardedRef
101
101
  ghost: true,
102
102
  columns: newColumns,
103
103
  toolBarRender,
104
+ // 简单的隐藏搜索栏
105
+ search: false,
104
106
  }}
105
107
  />
106
108
  </div>
@@ -37,6 +37,23 @@ function Table<
37
37
 
38
38
  const hasSearch = !!newColumns?.find((column) => column.search);
39
39
 
40
+ let newSearch: any = undefined;
41
+ if (hasSearch) {
42
+ newSearch = {
43
+ labelWidth: 'auto',
44
+ defaultCollapsed: false,
45
+ ...search,
46
+ };
47
+ } else if (search === false) {
48
+ newSearch = false;
49
+ } else {
50
+ newSearch = {
51
+ ...search,
52
+ };
53
+ }
54
+
55
+ console.log('newSearch', newSearch);
56
+
40
57
  return (
41
58
  <ProTable<DataSource, Params>
42
59
  cardBordered
@@ -46,17 +63,7 @@ function Table<
46
63
  // @ts-ignore 不会处理这里的 ts,或者成本大
47
64
  columns={newColumns}
48
65
  scroll={getTableScroll(newColumns)}
49
- search={
50
- hasSearch
51
- ? {
52
- labelWidth: 'auto',
53
- defaultCollapsed: false,
54
- ...search,
55
- }
56
- : {
57
- ...search,
58
- }
59
- }
66
+ search={newSearch}
60
67
  {...rest}
61
68
  />
62
69
  );