@fe-free/core 1.4.6 → 1.4.7

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.4.7
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: crud
8
+ - @fe-free/tool@1.4.7
9
+
3
10
  ## 1.4.6
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.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "",
5
5
  "main": "./src/index.ts",
6
6
  "author": "",
@@ -35,7 +35,7 @@
35
35
  "react-syntax-highlighter": "^15.5.0",
36
36
  "vanilla-jsoneditor": "^0.23.1",
37
37
  "zustand": "^4.5.4",
38
- "@fe-free/tool": "1.4.6"
38
+ "@fe-free/tool": "1.4.7"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@ant-design/pro-components": "^2.8.7",
package/src/crud/crud.tsx CHANGED
@@ -89,6 +89,8 @@ function CRUDComponent<
89
89
  }, []);
90
90
 
91
91
  const newColumns = useMemo(() => {
92
+ const idField = tableProps.rowKey || 'id';
93
+
92
94
  const operateColumn = {
93
95
  title: '操作',
94
96
  fixed: 'right',
@@ -99,7 +101,7 @@ function CRUDComponent<
99
101
  {operateColumnProps?.moreOperator && operateColumnProps.moreOperator(record)}
100
102
  {actions.includes('read') && (
101
103
  <CRUDDetail
102
- id={record.id}
104
+ id={record[idField]}
103
105
  record={record}
104
106
  onSuccess={handleReload}
105
107
  trigger={<a>{readProps?.operateText || '查看'}</a>}
@@ -117,7 +119,7 @@ function CRUDComponent<
117
119
  )}
118
120
  {actions.includes('update') && (
119
121
  <CRUDDetail
120
- id={record.id}
122
+ id={record[idField]}
121
123
  record={record}
122
124
  onSuccess={handleReload}
123
125
  trigger={<a>{updateProps?.operateText || '编辑'}</a>}
@@ -155,9 +157,10 @@ function CRUDComponent<
155
157
 
156
158
  return tableProps.columns as TableProps['columns'];
157
159
  }, [
160
+ tableProps.rowKey,
161
+ tableProps.columns,
158
162
  operateColumnProps,
159
163
  actions,
160
- tableProps.columns,
161
164
  handleReload,
162
165
  readProps?.operateText,
163
166
  readProps?.target,
@@ -77,6 +77,13 @@ export const ProFormSwitchNumberComponent: Story = {
77
77
  render: () => (
78
78
  <ProFormBase>
79
79
  <ProFormSwitchNumber name="switchNumber" />
80
+ <ProFormSwitchNumber
81
+ name="switchNumber"
82
+ fieldProps={{
83
+ checkedChildren: '开启',
84
+ unCheckedChildren: '关闭',
85
+ }}
86
+ />
80
87
  </ProFormBase>
81
88
  ),
82
89
  };
@@ -1,6 +1,10 @@
1
- export { ProFormSwitchNumber, SwitchNumber, type SwitchNumberProps } from './form_switch_number';
2
1
  export { ProFormJavascript } from './pro_form_javascript';
3
2
  export { ProFormJSON } from './pro_form_json';
3
+ export {
4
+ ProFormSwitchNumber,
5
+ SwitchNumber,
6
+ type SwitchNumberProps,
7
+ } from './pro_form_switch_number';
4
8
  import { pinyinMatch } from '@fe-free/tool';
5
9
 
6
10
  /** ProFromSelect 搜索相关 props。 支持 1 搜索 2 拼音过滤 */
@@ -12,7 +12,6 @@ function JavascriptItem(props: EditorJavascriptProps) {
12
12
  }
13
13
 
14
14
  function ProFormJavascript(props: ProFormItemProps<EditorJavascriptProps>) {
15
- // 没搞明白 cacheFormSwr, proFieldKey, onBlur,先这样处理
16
15
  /* eslint-disable-next-line */
17
16
  const { fieldProps, readonly, ...rest } = props;
18
17
 
@@ -12,7 +12,6 @@ function JSONItem(props: EditorJSONProps) {
12
12
  }
13
13
 
14
14
  function ProFormJSON(props: ProFormItemProps<EditorJSONProps>) {
15
- // 没搞明白 cacheFormSwr, proFieldKey, onBlur,先这样处理
16
15
  /* eslint-disable-next-line */
17
16
  const { fieldProps, readonly, ...rest } = props;
18
17
 
@@ -25,7 +25,6 @@ function SwitchNumber(props: SwitchNumberProps) {
25
25
  }
26
26
 
27
27
  function ProFormSwitchNumber(props: ProFormItemProps<SwitchNumberProps>) {
28
- // 没搞明白 cacheFormSwr, proFieldKey, onBlur,先这样处理
29
28
  /* eslint-disable-next-line */
30
29
  const { fieldProps, readonly, ...rest } = props;
31
30