@fe-free/core 1.5.0 → 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,19 @@
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
+
10
+ ## 1.5.1
11
+
12
+ ### Patch Changes
13
+
14
+ - fix: form
15
+ - @fe-free/tool@1.5.1
16
+
3
17
  ## 1.5.0
4
18
 
5
19
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fe-free/core",
3
- "version": "1.5.0",
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.0"
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>
@@ -11,7 +11,7 @@ function Edit<T>(props: {
11
11
  onChange: (values: T) => void;
12
12
  detailForm: JSX.Element;
13
13
  editForm?: any;
14
- disabledAddFormSubmitter?: boolean;
14
+ disabledSubmitter?: boolean;
15
15
  }) {
16
16
  const handleFinish = async (newValues) => {
17
17
  props.onChange(newValues as T);
@@ -26,31 +26,7 @@ function Edit<T>(props: {
26
26
  onFinish={handleFinish}
27
27
  formRef={props?.editForm}
28
28
  initialValues={props.values || undefined}
29
- submitter={
30
- props.disabledAddFormSubmitter
31
- ? false
32
- : {
33
- render: (props, defaultDoms) => {
34
- return [
35
- <div
36
- key="cancel"
37
- className="pr-[20px] w-[500px] pt-[12px]"
38
- style={{ borderTop: '1px solid rgba(0, 0, 0, 0.1)' }}
39
- >
40
- <div className="custom-button-container">
41
- {React.Children.map(defaultDoms, (dom) => {
42
- return React.cloneElement(dom, {
43
- className:
44
- 'w-[88px] h-[40px] text-base rounded-[0.5rem] ml-3' +
45
- (dom.props?.className || ''),
46
- });
47
- })}
48
- </div>
49
- </div>,
50
- ];
51
- },
52
- }
53
- }
29
+ submitter={props.disabledSubmitter ? false : undefined}
54
30
  >
55
31
  {props.detailForm}
56
32
  </ModalForm>
@@ -66,7 +42,7 @@ interface ProFormListModalHelperProps<T> {
66
42
  // 如果 addForm 存在,则使用 addForm 作为添加按钮
67
43
  addForm?: JSX.Element;
68
44
  // 禁用添加的提交按钮
69
- disabledAddFormSubmitter?: boolean;
45
+ disabledSubmitter?: boolean;
70
46
 
71
47
  disabledAdd?: boolean;
72
48
  // 触发添加
@@ -129,7 +105,7 @@ function ProFormListModalHelper<T = any>(props: ProFormListModalHelperProps<T>)
129
105
  }}
130
106
  detailForm={props.addForm || props.detailForm}
131
107
  editForm={props?.editForm}
132
- disabledAddFormSubmitter={props.disabledAddFormSubmitter}
108
+ disabledSubmitter={props.disabledSubmitter}
133
109
  >
134
110
  {props.addTrigger || (
135
111
  <Button size="small" icon={<PlusOutlined />}>
@@ -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
  );