@fe-free/core 1.4.10 → 1.4.11

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.11
4
+
5
+ ### Patch Changes
6
+
7
+ - feat: crud
8
+ - @fe-free/tool@1.4.11
9
+
3
10
  ## 1.4.10
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.10",
3
+ "version": "1.4.11",
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.10"
38
+ "@fe-free/tool": "1.4.11"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@ant-design/pro-components": "^2.8.7",
@@ -61,10 +61,9 @@ export const Normal: Story = {
61
61
  deleteProps={{
62
62
  nameIndex: 'name',
63
63
  }}
64
- detailForm={(formProps) => (
64
+ detailForm={() => (
65
65
  <>
66
66
  <ProFormText
67
- {...formProps}
68
67
  name="name"
69
68
  label="名字"
70
69
  required
@@ -188,10 +187,9 @@ export const MoreCustom: Story = {
188
187
  deleteProps={{
189
188
  nameIndex: 'name',
190
189
  }}
191
- detailForm={(formProps) => (
190
+ detailForm={() => (
192
191
  <>
193
192
  <ProFormText
194
- {...formProps}
195
193
  name="name"
196
194
  label="名字"
197
195
  required
@@ -235,17 +233,16 @@ const FormRefComponent = () => {
235
233
  request: fakeRequest,
236
234
  }}
237
235
  detailFormInstance={detailFormInstance}
238
- detailForm={(formProps) => (
236
+ detailForm={() => (
239
237
  <>
240
238
  <ProFormText
241
- {...formProps}
242
239
  name="name"
243
240
  label="名字"
244
241
  required
245
242
  rules={[{ required: true }]}
246
243
  initialValue={'default'}
247
244
  />
248
- <ProFormSwitch {...formProps} name="status" label="开启" initialValue={false} />
245
+ <ProFormSwitch name="status" label="开启" initialValue={false} />
249
246
  </>
250
247
  )}
251
248
  requestGetByRecord={fakeGetByRecord}
@@ -437,15 +434,9 @@ export const CustomText: Story = {
437
434
  successText: '编辑成功',
438
435
  }}
439
436
  requestDeleteByRecord={fakeDeleteByRecord}
440
- detailForm={(formProps) => (
437
+ detailForm={() => (
441
438
  <>
442
- <ProFormText
443
- {...formProps}
444
- name="name"
445
- label="名字"
446
- required
447
- rules={[{ required: true }]}
448
- />
439
+ <ProFormText name="name" label="名字" required rules={[{ required: true }]} />
449
440
  </>
450
441
  )}
451
442
  requestGetByRecord={fakeGetByRecord}
package/src/crud/crud.tsx CHANGED
@@ -2,6 +2,7 @@ import type { ActionType } from '@ant-design/pro-components';
2
2
  import { Button, message, Space } from 'antd';
3
3
  import { isString } from 'lodash-es';
4
4
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
5
+ import { Link } from 'react-router-dom';
5
6
  import type { TableProps } from '../table';
6
7
  import { Table } from '../table';
7
8
  import { OperateDelete } from './crud_delete';
@@ -122,12 +123,9 @@ function CRUDComponent<
122
123
  />
123
124
  )}
124
125
  {actions.includes('read_detail') && (
125
- <a
126
- href={`${window.location.pathname}/detail/${record[detailIdIndex || 'id']}`}
127
- target={readProps?.target}
128
- >
126
+ <Link to={`./detail/${record[detailIdIndex || 'id']}`} target={readProps?.target}>
129
127
  {readProps?.operateText || '查看'}
130
- </a>
128
+ </Link>
131
129
  )}
132
130
  {actions.includes('update') && (
133
131
  <CRUDDetail
@@ -41,10 +41,9 @@ export const Normal: Story = {
41
41
  deleteProps={{
42
42
  nameIndex: 'name',
43
43
  }}
44
- detailForm={(formProps) => (
44
+ detailForm={() => (
45
45
  <>
46
46
  <ProFormText
47
- {...formProps}
48
47
  name="name"
49
48
  label="名字"
50
49
  required
@@ -87,10 +86,9 @@ export const WithSearch: Story = {
87
86
  deleteProps={{
88
87
  nameIndex: 'name',
89
88
  }}
90
- detailForm={(formProps) => (
89
+ detailForm={() => (
91
90
  <>
92
91
  <ProFormText
93
- {...formProps}
94
92
  name="name"
95
93
  label="名字"
96
94
  required