@fe-free/core 4.1.40 → 4.1.42
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 +16 -0
- package/package.json +5 -3
- package/src/crud/crud.tsx +5 -2
- package/src/crud/helper.tsx +3 -3
- package/src/crud/table/index.tsx +7 -2
- package/src/crud/use_operate.tsx +1 -1
- package/src/crud_of_pure/crud_of_pure.stories.tsx +7 -1
- package/src/crud_of_pure/index.tsx +52 -2
- package/src/crud_of_pure/style.scss +4 -0
- package/src/index.ts +2 -1
- package/src/markdown/chart.tsx +3 -3
- package/src/markdown/code.tsx +19 -32
- package/src/markdown/custom_markdown.stories.tsx +485 -0
- package/src/markdown/hm_chart.tsx +1 -1
- package/src/markdown/index.tsx +93 -34
- package/src/markdown/knowledge_ref.tsx +5 -5
- package/src/markdown/markdown.stories.tsx +68 -410
- package/src/markdown/messages/message_think.tsx +69 -0
- package/src/markdown/messages/svgs/think.svg +3 -0
- package/src/markdown/think.tsx +55 -0
- package/src/value_type_map/index.tsx +7 -0
- package/src/value_type_map/json_modal.tsx +17 -15
- package/src/value_type_map/markdown_modal.tsx +44 -0
- package/src/value_type_map/value_type_map.stories.tsx +8 -0
- package/src/markdown/deep_seek.tsx +0 -53
- package/src/markdown/style.scss +0 -46
|
@@ -31,21 +31,23 @@ function Render(text, props: ProFormItemProps<JSONModalProps>) {
|
|
|
31
31
|
return (
|
|
32
32
|
<>
|
|
33
33
|
<a onClick={() => setShow(true)}>{title}</a>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
{show && (
|
|
35
|
+
<Modal
|
|
36
|
+
title={title}
|
|
37
|
+
open
|
|
38
|
+
onCancel={() => setShow(false)}
|
|
39
|
+
onOk={() => setShow(false)}
|
|
40
|
+
cancelButtonProps={{
|
|
41
|
+
style: {
|
|
42
|
+
display: 'none',
|
|
43
|
+
},
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<div className="h-[500px]">
|
|
47
|
+
<EditorJSON value={jsonText} readonly />
|
|
48
|
+
</div>
|
|
49
|
+
</Modal>
|
|
50
|
+
)}
|
|
49
51
|
</>
|
|
50
52
|
);
|
|
51
53
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Modal } from 'antd';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Markdown } from '../markdown';
|
|
4
|
+
|
|
5
|
+
function Render(text) {
|
|
6
|
+
const [show, setShow] = useState(false);
|
|
7
|
+
|
|
8
|
+
if (!text) {
|
|
9
|
+
return <div>-</div>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<div onClick={() => setShow(true)} className="flex cursor-pointer items-center">
|
|
15
|
+
<div className="truncate">{text}</div>
|
|
16
|
+
<span className="text-primary">查看</span>
|
|
17
|
+
</div>
|
|
18
|
+
{show && (
|
|
19
|
+
<Modal
|
|
20
|
+
title="Markdown"
|
|
21
|
+
open
|
|
22
|
+
onCancel={() => setShow(false)}
|
|
23
|
+
onOk={() => setShow(false)}
|
|
24
|
+
cancelButtonProps={{
|
|
25
|
+
style: {
|
|
26
|
+
display: 'none',
|
|
27
|
+
},
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<div className="h-[500px]">
|
|
31
|
+
<Markdown content={text} />
|
|
32
|
+
</div>
|
|
33
|
+
</Modal>
|
|
34
|
+
)}
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const markdownModalRender = {
|
|
40
|
+
render: Render,
|
|
41
|
+
renderFormItem: () => <></>,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { markdownModalRender };
|
|
@@ -25,6 +25,7 @@ async function fakeRequest() {
|
|
|
25
25
|
dateNumber: +dayjs('2024-10-01'),
|
|
26
26
|
seconds: Math.abs(+dayjs('2024-10-01') / 1000),
|
|
27
27
|
jsonText: JSON.stringify({ name: 'hello world hello world hello world' }),
|
|
28
|
+
markdownText: `# Hello World\n\nThis is a markdown text.`,
|
|
28
29
|
switchNumber: Math.random() > 0.5 ? 1 : 0,
|
|
29
30
|
switchOptions: Math.random() > 0.5 ? 'ON' : 'OFF',
|
|
30
31
|
}));
|
|
@@ -84,6 +85,12 @@ const Table = () => {
|
|
|
84
85
|
ellipsis: true,
|
|
85
86
|
valueType: CustomValueTypeEnum.CustomJSONModal,
|
|
86
87
|
},
|
|
88
|
+
{
|
|
89
|
+
title: 'markdownModal',
|
|
90
|
+
dataIndex: 'markdownText',
|
|
91
|
+
ellipsis: true,
|
|
92
|
+
valueType: CustomValueTypeEnum.CustomMarkdownModal,
|
|
93
|
+
},
|
|
87
94
|
{
|
|
88
95
|
title: '开关 number',
|
|
89
96
|
dataIndex: 'switchNumber',
|
|
@@ -104,6 +111,7 @@ const Table = () => {
|
|
|
104
111
|
<CRUD
|
|
105
112
|
actions={[]}
|
|
106
113
|
tableProps={{
|
|
114
|
+
rowKey: 'id',
|
|
107
115
|
columns,
|
|
108
116
|
request: fakeRequest,
|
|
109
117
|
}}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { DownOutlined, UpOutlined } from '@fe-free/icons';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
|
|
4
|
-
function DeepSeekBlock(props: { children: string }) {
|
|
5
|
-
const [show, setShow] = useState(true);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<div className="markdown-body-block-deep-seek mb-3 flex flex-col gap-2 text-[12px] text-03">
|
|
9
|
-
<div
|
|
10
|
-
className="cursor-pointer"
|
|
11
|
-
onClick={() => {
|
|
12
|
-
setShow((v) => !v);
|
|
13
|
-
}}
|
|
14
|
-
>
|
|
15
|
-
深度思考 {show ? <UpOutlined /> : <DownOutlined />}
|
|
16
|
-
</div>
|
|
17
|
-
{show && (
|
|
18
|
-
<div className="relative pl-[15px]">
|
|
19
|
-
<div className="top=0 absolute left-0 h-full w-[2px] bg-[#00000014]" />
|
|
20
|
-
{props.children === '<br/>' ? undefined : props.children}
|
|
21
|
-
</div>
|
|
22
|
-
)}
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function processWithDeepSeek(text: string) {
|
|
28
|
-
// 开始 <think> 才算开始
|
|
29
|
-
if (!text.startsWith('<think>')) {
|
|
30
|
-
return text;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const [left, right] = text.split('</think>');
|
|
34
|
-
|
|
35
|
-
let newText = text;
|
|
36
|
-
|
|
37
|
-
// 如果 think 部分是 <think>\n\n</think>,相当于没有,则直接返回 right
|
|
38
|
-
if (text.startsWith('<think>\n\n</think>')) {
|
|
39
|
-
newText = right;
|
|
40
|
-
}
|
|
41
|
-
// 否则做一些处理
|
|
42
|
-
else {
|
|
43
|
-
newText =
|
|
44
|
-
left
|
|
45
|
-
.replace('<think>\n', '<think>')
|
|
46
|
-
.replace('\n</think>', '</think>')
|
|
47
|
-
.replace(/\n/g, '<br/>') + (right || '');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return newText;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { DeepSeekBlock, processWithDeepSeek };
|
package/src/markdown/style.scss
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.markdown-body {
|
|
2
|
-
font-size: 14px;
|
|
3
|
-
|
|
4
|
-
pre {
|
|
5
|
-
padding: 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.markdown-body-block-code {
|
|
9
|
-
margin: 0.5rem 0;
|
|
10
|
-
|
|
11
|
-
& > div {
|
|
12
|
-
margin: 0 !important;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.markdown-body-block-chart {
|
|
17
|
-
background: white;
|
|
18
|
-
border-radius: 6px;
|
|
19
|
-
margin: 0.5rem;
|
|
20
|
-
|
|
21
|
-
.markdown-body-block-chart-title {
|
|
22
|
-
font-size: 16px;
|
|
23
|
-
font-weight: bold;
|
|
24
|
-
padding: 10px;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.markdown-body-block-knowledge-ref[data-id] {
|
|
29
|
-
height: 16px;
|
|
30
|
-
min-width: 16px;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
display: inline-flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
justify-content: center;
|
|
35
|
-
border-radius: 999px;
|
|
36
|
-
border: 1px solid #0374e9;
|
|
37
|
-
color: #0374e9;
|
|
38
|
-
font-size: 12px;
|
|
39
|
-
padding: 0 4px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.markdown-body-block-knowledge-ref-source {
|
|
43
|
-
color: #0374e9;
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
}
|
|
46
|
-
}
|