@fe-free/core 1.2.4 → 1.3.1

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/src/crud/index.md DELETED
@@ -1,158 +0,0 @@
1
- ---
2
- nav:
3
- title: '组件'
4
- order: 10
5
- group: 'core'
6
- toc: content
7
- ---
8
-
9
- # CRUD
10
-
11
- > 需要了解 ant pro-components ProForm ProTable
12
-
13
- 基于 ant pro-components 通用的 CRUD 组件,同时保留扩展性。
14
-
15
- ## 代码演示
16
-
17
- ### 常规
18
-
19
- ```tsx
20
- import { Normal } from './demo';
21
-
22
- export default Normal;
23
- ```
24
-
25
- ### 详情页查看
26
-
27
- 调整 actions 为 `['read_detail']`,点击<查看>跳转到 `xxx/detail/[id]`,
28
-
29
- ```tsx
30
- import { ReadDetail } from './demo';
31
-
32
- export default ReadDetail;
33
- ```
34
-
35
- ### 数据 本地&远程&依赖
36
-
37
- ```tsx
38
- import { RemoteData } from './demo';
39
-
40
- export default RemoteData;
41
- ```
42
-
43
- ### 表格表单和详情表单 ref
44
-
45
- 获取 ProTable 的 actionRef
46
-
47
- ```tsx
48
- import { Ref } from './demo';
49
-
50
- export default Ref;
51
- ```
52
-
53
- ### ref.current.getActionRef
54
-
55
- 通过 ref 你可以做更多操作
56
-
57
- ```tsx
58
- import { ActionRef } from './demo';
59
-
60
- export default ActionRef;
61
- ```
62
-
63
- ### 没有搜索
64
-
65
- ```tsx
66
- import { NoSearch } from './demo';
67
-
68
- export default NoSearch;
69
- ```
70
-
71
- ### 自定义文案
72
-
73
- ```tsx
74
- import { CustomText } from './demo';
75
-
76
- export default CustomText;
77
- ```
78
-
79
- ## API
80
-
81
- ```tsx | pure
82
- import type { ReactNode } from 'react';
83
- import type { TableProps } from '../table';
84
- import type { ProFormInstance, ActionType } from '@ant-design/pro-components';
85
-
86
- /**
87
- * create 创建
88
- * read 查看
89
- * read_detail 详情页查看
90
- * update 编辑
91
- * delete 删除
92
- */
93
- type CrudAction = 'create' | 'read' | 'read_detail' | 'update' | 'delete';
94
-
95
- interface CRUDProps {
96
- actions: CrudAction[];
97
-
98
- /** 新建按钮,默认新建 */
99
- createButton?: ReactNode;
100
-
101
- /** 表格相关 */
102
- tableProps: TableProps;
103
- operateColumnProps?: {
104
- width?: number;
105
- /** 扩展操作区域 */
106
- moreOperator?: (record) => ReactNode;
107
- };
108
- readProps?: {
109
- /** 文本 */
110
- operateText?: string;
111
- /** 打开方式, action 为 read_detail 有效 */
112
- target?: '_blank';
113
- };
114
-
115
- /** 删除接口 */
116
- requestDeleteByRecord?: (record) => Promise<any>;
117
- /** 删除相关 */
118
- deleteProps?: {
119
- /** 显示名称索引 */
120
- nameIndex: string;
121
- /** 删除确认描述 */
122
- desc?: string;
123
- /** 文本 */
124
- operateText?: string;
125
- };
126
-
127
- /** 弹窗表单 */
128
- detailForm?: (formProps: { readonly: boolean }, info: { action: CrudAction }) => ReactNode;
129
- /** detailForm 的 formRef */
130
- detailFormInstance?: ProFormInstance;
131
-
132
- /** 新增接口 */
133
- requestCreateByValues?: (values) => Promise<any>;
134
- createProps?: {
135
- /** 成功文案 */
136
- successText?: string | (() => string);
137
- };
138
-
139
- /** 更新接口 */
140
- requestUpdateById?: (values) => Promise<any>;
141
- updateProps?: {
142
- /** 文本 */
143
- operateText?: string;
144
- /** 成功文案 */
145
- successText?: string | (() => string);
146
- };
147
-
148
- /** 获取详情接口 */
149
- requestGetByRecord?: (record) => Promise<any>;
150
-
151
- /** 跳转到详情的索引 ,默认 id */
152
- detailIdIndex?: string;
153
- }
154
-
155
- interface CRUDMethods {
156
- getActionRef: () => React.MutableRefObject<ActionType | undefined>;
157
- }
158
- ```
@@ -1,48 +0,0 @@
1
- ---
2
- group: 'core'
3
- toc: content
4
- ---
5
-
6
- # EditorLogs
7
-
8
- `LogViewer` 是一个用于显示日志内容的 React 组件。它使用 CodeMirror 编辑器来呈现日志,提供了语法高亮和主题支持。
9
-
10
- ## 代码演示
11
-
12
- ### 常规
13
-
14
- ```tsx
15
- import { EditorLogs } from '@fe-free/core';
16
-
17
- function Demo() {
18
- return (
19
- <EditorLogs
20
- logs={[
21
- {
22
- timestamp: '2023-01-01 12:00:00',
23
- level: 'info',
24
- message: 'This is an info log message.',
25
- },
26
- {
27
- timestamp: '2023-01-01 12:00:00',
28
- level: 'warn',
29
- message: 'This is a warning log message.',
30
- },
31
- {
32
- timestamp: '2023-01-01 12:00:00',
33
- level: 'error',
34
- message: 'This is an error log message.',
35
- },
36
- {
37
- timestamp: '2023-01-01 12:00:00',
38
- level: 'system',
39
- message:
40
- 'This is a debug log message. This is a debug log message This is a debug log message This is a debug log message This is a debug log message',
41
- },
42
- ]}
43
- />
44
- );
45
- }
46
-
47
- export default Demo;
48
- ```
@@ -1,40 +0,0 @@
1
- ---
2
- group: 'core'
3
- toc: content
4
- ---
5
-
6
- # EditorMarkdown
7
-
8
- ## 代码演示
9
-
10
- ### 常规
11
-
12
- ```tsx
13
- import { useState } from 'react';
14
- import { EditorMarkdown } from '@fe-free/core';
15
-
16
- function Demo() {
17
- const [value] = useState(
18
- `# hello
19
-
20
- world
21
- `
22
- );
23
-
24
- return (
25
- <div style={{ width: '500px', height: '500px' }}>
26
- <EditorMarkdown value={value} />
27
- </div>
28
- );
29
- }
30
-
31
- export default Demo;
32
- ```
33
-
34
- ## API
35
-
36
- ```tsx | pure
37
- interface EditorMarkdownProps {
38
- value: string;
39
- }
40
- ```
package/src/form/index.md DELETED
@@ -1,96 +0,0 @@
1
- ---
2
- group: 'core'
3
- toc: content
4
- ---
5
-
6
- # Form
7
-
8
- ## ProFormJSON
9
-
10
- JSON
11
-
12
- ```tsx
13
- import { ProForm } from '@ant-design/pro-components';
14
- import { ProFormJSON } from '@fe-free/core';
15
-
16
- function Demo() {
17
- return (
18
- <ProForm>
19
- <ProFormJSON name="json" initialValue={JSON.stringify({ name: 'world' }, null, 2)} />
20
- </ProForm>
21
- );
22
- }
23
-
24
- export default Demo;
25
- ```
26
-
27
- readonly
28
-
29
- ```tsx
30
- import { ProForm } from '@ant-design/pro-components';
31
- import { ProFormJSON } from '@fe-free/core';
32
-
33
- function Demo() {
34
- return (
35
- <ProForm>
36
- <ProFormJSON
37
- name="json"
38
- readonly
39
- initialValue={JSON.stringify({ name: 'world' }, null, 2)}
40
- fieldProps={{
41
- mainMenuBar: false,
42
- }}
43
- />
44
- </ProForm>
45
- );
46
- }
47
-
48
- export default Demo;
49
- ```
50
-
51
- ## ProFormJavascript
52
-
53
- JSON
54
-
55
- ```tsx
56
- import { ProForm } from '@ant-design/pro-components';
57
- import { ProFormJavascript } from '@fe-free/core';
58
-
59
- function Demo() {
60
- return (
61
- <ProForm>
62
- <ProFormJavascript
63
- name="json"
64
- initialValue={`const name = 'world';
65
- console.log('hello', name);
66
- `}
67
- />
68
- </ProForm>
69
- );
70
- }
71
-
72
- export default Demo;
73
- ```
74
-
75
- readonly
76
-
77
- ```tsx
78
- import { ProForm } from '@ant-design/pro-components';
79
- import { ProFormJavascript } from '@fe-free/core';
80
-
81
- function Demo() {
82
- return (
83
- <ProForm>
84
- <ProFormJavascript
85
- name="json"
86
- readonly
87
- initialValue={`const name = 'world';
88
- console.log('hello', name);
89
- `}
90
- />
91
- </ProForm>
92
- );
93
- }
94
-
95
- export default Demo;
96
- ```
@@ -1,89 +0,0 @@
1
- ---
2
- group: 'core'
3
- toc: content
4
- ---
5
-
6
- # Table
7
-
8
- 对 ProTable 做扩展以满足实际使用情况
9
-
10
- - 默认搜索关闭,需要再打开 `search: true`
11
- - 有搜索的时候才显示搜索区域
12
-
13
- ## 场景
14
-
15
- ### 常规
16
-
17
- ```tsx
18
- import { Table } from '@fe-free/core';
19
- import { fakeData } from '../crud/demo/data';
20
-
21
- function fakeRequest() {
22
- return Promise.resolve({
23
- data: fakeData,
24
- success: true,
25
- total: fakeData.length,
26
- });
27
- }
28
-
29
- const Demo = () => {
30
- const columns = [
31
- {
32
- title: 'id',
33
- dataIndex: 'id',
34
- search: true,
35
- },
36
- {
37
- title: '名字(省略)',
38
- dataIndex: 'name',
39
- search: true,
40
- ellipsis: true,
41
- },
42
- {
43
- title: 'city',
44
- dataIndex: 'city',
45
- },
46
- {
47
- title: 'area',
48
- dataIndex: 'area',
49
- },
50
- ];
51
-
52
- return <Table rowKey="id" columns={columns} request={fakeRequest} />;
53
- };
54
-
55
- export default Demo;
56
- ```
57
-
58
- ### 没有搜索
59
-
60
- ```tsx
61
- import { Table } from '@fe-free/core';
62
-
63
- const Demo = () => {
64
- const columns = [
65
- {
66
- title: 'id',
67
- dataIndex: 'id',
68
- },
69
- {
70
- title: '名字(省略)',
71
- dataIndex: 'name',
72
-
73
- ellipsis: true,
74
- },
75
- {
76
- title: 'city',
77
- dataIndex: 'city',
78
- },
79
- {
80
- title: 'area',
81
- dataIndex: 'area',
82
- },
83
- ];
84
-
85
- return <Table columns={columns} rowKey="id" />;
86
- };
87
-
88
- export default Demo;
89
- ```