@yuntijs/ui 1.0.0-beta.105 → 1.0.0-beta.107
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/es/ChatMarkdown/utils.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// 预处理函数:确保 think 标签前后有两个换行符
|
|
2
2
|
export var normalizeThinkTags = function normalizeThinkTags(markdown) {
|
|
3
|
+
var reg1 = new RegExp('([^\\n])\\s*<think>', 'g');
|
|
4
|
+
var reg2 = new RegExp('<think>\\s*([^\\n])', 'g');
|
|
5
|
+
var reg3 = new RegExp('([^\\n])\\s*<\\/think>', 'g');
|
|
6
|
+
var reg4 = new RegExp('<\\/think>\\s*([^\\n])', 'g');
|
|
7
|
+
var reg5 = new RegExp('\\n{3,}', 'g');
|
|
3
8
|
return (markdown || ''
|
|
4
9
|
// 确保 <think> 标签前后有两个换行符
|
|
5
|
-
).replaceAll(
|
|
10
|
+
).replaceAll(reg1, '$1\n\n<think>').replaceAll(reg2, '<think>\n\n$1')
|
|
6
11
|
// 确保 </think> 标签前后有两个换行符
|
|
7
|
-
.replaceAll(
|
|
12
|
+
.replaceAll(reg3, '$1\n\n</think>').replaceAll(reg4, '</think>\n\n$1')
|
|
8
13
|
// 处理可能产生的多余换行符
|
|
9
|
-
.replaceAll(
|
|
14
|
+
.replaceAll(reg5, '\n\n');
|
|
10
15
|
};
|
|
@@ -2,6 +2,9 @@ import { type FormListOperation } from 'antd';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { FormCollapseListColumn } from '.';
|
|
4
4
|
import { ListFieldValue } from './utils';
|
|
5
|
+
export interface FormCollapseListOperation extends FormListOperation {
|
|
6
|
+
update: () => void;
|
|
7
|
+
}
|
|
5
8
|
export declare const useFormCollapseListHooks: (name: string, childrenColumnName: string, columns: FormCollapseListColumn[]) => {
|
|
6
9
|
values: ListFieldValue[];
|
|
7
10
|
updateValues: () => void;
|
|
@@ -12,6 +15,6 @@ export declare const useFormCollapseListHooks: (name: string, childrenColumnName
|
|
|
12
15
|
allExpandRowKeys: React.Key[];
|
|
13
16
|
};
|
|
14
17
|
getFieldPath: (fieldKeyPath: number[], fieldName?: string) => any;
|
|
15
|
-
getFormListOperation: (operation: FormListOperation, record: ListFieldValue) =>
|
|
18
|
+
getFormListOperation: (operation: FormListOperation, record: ListFieldValue) => FormCollapseListOperation;
|
|
16
19
|
firstColumnFormItemName: any;
|
|
17
20
|
};
|
|
@@ -138,6 +138,9 @@ export var useFormCollapseListHooks = function useFormCollapseListHooks(name, ch
|
|
|
138
138
|
fieldValue[to] = _ref[1];
|
|
139
139
|
form.setFieldValue(fieldName, fieldValue);
|
|
140
140
|
updateValues();
|
|
141
|
+
},
|
|
142
|
+
update: function update() {
|
|
143
|
+
return updateValues();
|
|
141
144
|
}
|
|
142
145
|
};
|
|
143
146
|
}, [childrenColumnName, expandedRowKeys, firstColumnFormItemName, form, getFieldPath, name, updateValues]);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { FormItemProps,
|
|
1
|
+
import type { FormItemProps, TableColumnProps } from 'antd';
|
|
2
2
|
import type { FormListProps as AntFormListProps } from 'antd/es/form';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { CollapseGroupProps } from '../../CollapseGroup';
|
|
5
|
+
import { FormCollapseListOperation } from './hooks';
|
|
5
6
|
import { FieldPath } from './utils';
|
|
6
7
|
interface FormCollapseListColumnItem extends Omit<FormItemProps, 'dependencies' | 'rules' | 'tooltip' | 'labelAlign' | 'labelCol' | 'colon' | 'children'> {
|
|
7
|
-
render?: (fieldName: number, index: number, operation:
|
|
8
|
+
render?: (fieldName: number, index: number, operation: FormCollapseListOperation,
|
|
8
9
|
/** 当前 item 的 path */
|
|
9
10
|
fieldPath: FieldPath) => React.ReactElement;
|
|
10
11
|
rules?: FormItemProps['rules'] | ((parentFieldPath: FieldPath, index: number) => FormItemProps['rules']);
|