mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
chore: 去除 ansi-to-react 依赖,日志模块不再提供高亮功能 (#5376)
This commit is contained in:
parent
19e0216539
commit
63e3a2bfda
@ -160,15 +160,14 @@ public class StreamingResponseBodyController {
|
||||
|
||||
## 属性表
|
||||
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| ------------ | --------- | ------ | ----------------------------------------------- |
|
||||
| height | `number` | 500 | 展示区域高度 |
|
||||
| className | `string` | | 外层 CSS 类名 |
|
||||
| autoScroll | `boolean` | true | 是否自动滚动 |
|
||||
| placeholder | `string` | | 加载中的文字 |
|
||||
| encoding | `string` | utf-8 | 返回内容的字符编码 |
|
||||
| source | `string` | | 接口 |
|
||||
| rowHeight | `number` | | 设置每行高度,将会开启虚拟渲染 |
|
||||
| maxLength | `number` | | 最大显示行数 |
|
||||
| disableColor | `boolean` | | 关闭 ANSI 颜色支持 |
|
||||
| operation | `Array` | | 可选日志操作:['stop','clear','showLineNumber','filter'] |
|
||||
| 属性名 | 类型 | 默认值 | 说明 |
|
||||
| ----------- | --------- | ------ | -------------------------------------------------------- |
|
||||
| height | `number` | 500 | 展示区域高度 |
|
||||
| className | `string` | | 外层 CSS 类名 |
|
||||
| autoScroll | `boolean` | true | 是否自动滚动 |
|
||||
| placeholder | `string` | | 加载中的文字 |
|
||||
| encoding | `string` | utf-8 | 返回内容的字符编码 |
|
||||
| source | `string` | | 接口 |
|
||||
| rowHeight | `number` | | 设置每行高度,将会开启虚拟渲染 |
|
||||
| maxLength | `number` | | 最大显示行数 |
|
||||
| operation | `Array` | | 可选日志操作:['stop','clear','showLineNumber','filter'] |
|
||||
|
@ -223,7 +223,7 @@ fis.match('*.html:jsx', {
|
||||
|
||||
// 这些用了 esm
|
||||
fis.match(
|
||||
'{echarts/extension/**.js,zrender/**.js,ansi-to-react/lib/index.js,markdown-it-html5-media/**.js}',
|
||||
'{echarts/extension/**.js,zrender/**.js,markdown-it-html5-media/**.js}',
|
||||
{
|
||||
parser: fis.plugin('typescript', {
|
||||
sourceMap: false,
|
||||
|
@ -56,7 +56,7 @@
|
||||
"rollup": "^2.60.2",
|
||||
"rollup-plugin-license": "^2.6.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"sass": "^1.54.0",
|
||||
"sass": "^1.54.9",
|
||||
"sass-loader": "^12.1.0",
|
||||
"style-loader": "^3.2.1",
|
||||
"stylelint": "^13.0.0",
|
||||
|
@ -91,7 +91,7 @@
|
||||
"rollup-plugin-license": "^2.7.0",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-scss": "^3.0.0",
|
||||
"sass": "^1.54.0",
|
||||
"sass": "^1.54.9",
|
||||
"ts-jest": "^28.0.3",
|
||||
"typescript": "^4.6.4"
|
||||
},
|
||||
|
@ -42,7 +42,6 @@
|
||||
"dependencies": {
|
||||
"amis-core": "^2.2.0",
|
||||
"amis-ui": "^2.2.0",
|
||||
"ansi-to-react": "^6.1.6",
|
||||
"attr-accept": "2.2.2",
|
||||
"blueimp-canvastoblob": "2.1.0",
|
||||
"classnames": "2.3.1",
|
||||
|
@ -4,7 +4,6 @@
|
||||
import React from 'react';
|
||||
import {buildApi, isApiOutdated, Renderer, RendererProps} from 'amis-core';
|
||||
import {BaseSchema} from '../Schema';
|
||||
import Ansi from 'ansi-to-react';
|
||||
import {Icon, SearchBox, VirtualList} from 'amis-ui';
|
||||
|
||||
export type LogOperation =
|
||||
@ -59,11 +58,6 @@ export interface LogSchema extends BaseSchema {
|
||||
*/
|
||||
rowHeight?: number;
|
||||
|
||||
/**
|
||||
* 关闭 ANSI 颜色支持
|
||||
*/
|
||||
disableColor?: boolean;
|
||||
|
||||
/**
|
||||
* 一些可操作选项
|
||||
*/
|
||||
@ -285,17 +279,6 @@ export class Log extends React.Component<LogProps, LogState> {
|
||||
});
|
||||
}
|
||||
|
||||
renderHighlightWordWithAnsi(line: string) {
|
||||
let {filterWord} = this.state;
|
||||
if (filterWord === '') {
|
||||
return line;
|
||||
}
|
||||
return line.replaceAll(
|
||||
filterWord,
|
||||
`\u001b[43;1m\u001b[30;1m${filterWord}\u001b[0m`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染某一行
|
||||
*/
|
||||
@ -306,11 +289,7 @@ export class Log extends React.Component<LogProps, LogState> {
|
||||
{showLineNumber && (
|
||||
<span className={cx('Log-line-number')}>{index + 1} </span>
|
||||
)}
|
||||
{disableColor ? (
|
||||
this.renderHighlightWord(line)
|
||||
) : (
|
||||
<Ansi useClasses>{this.renderHighlightWordWithAnsi(line)}</Ansi>
|
||||
)}
|
||||
{this.renderHighlightWord(line)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -359,13 +338,7 @@ export class Log extends React.Component<LogProps, LogState> {
|
||||
{showLineNumber && (
|
||||
<span className={cx('Log-line-number')}>{index + 1} </span>
|
||||
)}
|
||||
{disableColor ? (
|
||||
this.renderHighlightWord(logs[index])
|
||||
) : (
|
||||
<Ansi useClasses>
|
||||
{this.renderHighlightWordWithAnsi(logs[index])}
|
||||
</Ansi>
|
||||
)}
|
||||
{this.renderHighlightWord(logs[index])}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user