@fe-free/core 1.4.12 → 1.4.13
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 +7 -0
- package/package.json +2 -2
- package/src/crud/crud.tsx +2 -2
- package/src/editor/index.tsx +7 -2
- package/src/form/form.stories.tsx +15 -1
- package/src/form/index.tsx +2 -0
- package/src/form/pro_form_editor.tsx +21 -0
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fe-free/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.13",
|
|
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.
|
|
38
|
+
"@fe-free/tool": "1.4.13"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@ant-design/pro-components": "^2.8.7",
|
package/src/crud/crud.tsx
CHANGED
|
@@ -205,13 +205,13 @@ function CRUDComponent<
|
|
|
205
205
|
tableProps.columns,
|
|
206
206
|
operateColumnProps,
|
|
207
207
|
actions,
|
|
208
|
+
deleteProps,
|
|
208
209
|
handleReload,
|
|
209
210
|
readProps?.operateText,
|
|
210
211
|
readProps?.target,
|
|
211
212
|
detailProps,
|
|
212
213
|
detailIdIndex,
|
|
213
|
-
updateProps
|
|
214
|
-
deleteProps,
|
|
214
|
+
updateProps,
|
|
215
215
|
getHandleDelete,
|
|
216
216
|
]);
|
|
217
217
|
|
package/src/editor/index.tsx
CHANGED
|
@@ -15,6 +15,9 @@ interface EditorProps {
|
|
|
15
15
|
readOnly?: boolean;
|
|
16
16
|
editable?: boolean;
|
|
17
17
|
|
|
18
|
+
height?: string;
|
|
19
|
+
width?: string;
|
|
20
|
+
|
|
18
21
|
// 不对外
|
|
19
22
|
theme?: ReactCodeMirrorProps['theme'];
|
|
20
23
|
extensions?: ReactCodeMirrorProps['extensions'];
|
|
@@ -29,6 +32,8 @@ function Editor(props: EditorProps) {
|
|
|
29
32
|
editable,
|
|
30
33
|
autoFocus,
|
|
31
34
|
placeholder,
|
|
35
|
+
height,
|
|
36
|
+
width,
|
|
32
37
|
theme,
|
|
33
38
|
extensions: originExtensions,
|
|
34
39
|
} = props;
|
|
@@ -70,8 +75,8 @@ function Editor(props: EditorProps) {
|
|
|
70
75
|
return (
|
|
71
76
|
<CodeMirror
|
|
72
77
|
className="w-full h-full"
|
|
73
|
-
height=
|
|
74
|
-
width=
|
|
78
|
+
height={height || '100%'}
|
|
79
|
+
width={width || '100%'}
|
|
75
80
|
value={value}
|
|
76
81
|
onChange={handleChange}
|
|
77
82
|
extensions={extensions}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProForm } from '@ant-design/pro-components';
|
|
2
|
-
import { ProFormJSON, ProFormJavascript, ProFormSwitchNumber } from '@fe-free/core';
|
|
2
|
+
import { ProFormEditor, ProFormJSON, ProFormJavascript, ProFormSwitchNumber } from '@fe-free/core';
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
@@ -37,6 +37,20 @@ function ProFormBase({
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export const ProFormEditorComponent: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<ProFormBase
|
|
43
|
+
initialValues={{
|
|
44
|
+
code: `const name = 'world';
|
|
45
|
+
console.log('hello', name);
|
|
46
|
+
`,
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<ProFormEditor name="code" fieldProps={{ language: 'javascript', height: '50vh' }} />
|
|
50
|
+
</ProFormBase>
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
|
|
40
54
|
// ProFormJSON 基础示例
|
|
41
55
|
export const ProFormJSONComponent: Story = {
|
|
42
56
|
render: () => (
|
package/src/form/index.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { ProFormEditor } from './pro_form_editor';
|
|
1
2
|
export { ProFormJavascript } from './pro_form_javascript';
|
|
2
3
|
export { ProFormJSON } from './pro_form_json';
|
|
3
4
|
export {
|
|
@@ -5,6 +6,7 @@ export {
|
|
|
5
6
|
SwitchNumber,
|
|
6
7
|
type SwitchNumberProps,
|
|
7
8
|
} from './pro_form_switch_number';
|
|
9
|
+
|
|
8
10
|
import { pinyinMatch } from '@fe-free/tool';
|
|
9
11
|
|
|
10
12
|
/** ProFromSelect 搜索相关 props。 支持 1 搜索 2 拼音过滤 */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ProFormItemProps } from '@ant-design/pro-components';
|
|
2
|
+
import { ProForm } from '@ant-design/pro-components';
|
|
3
|
+
import type { EditorProps } from '../editor';
|
|
4
|
+
import { Editor } from '../editor';
|
|
5
|
+
|
|
6
|
+
function EditorItem(props: EditorProps) {
|
|
7
|
+
return <Editor height="300px" {...props} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function ProFormEditor(props: ProFormItemProps<EditorProps>) {
|
|
11
|
+
/* eslint-disable-next-line */
|
|
12
|
+
const { fieldProps, readonly, ...rest } = props;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ProForm.Item {...rest}>
|
|
16
|
+
<EditorItem readOnly={readonly} {...(fieldProps as EditorProps)} />
|
|
17
|
+
</ProForm.Item>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { ProFormEditor };
|