diff --git a/ide/src/base-ui/table/lit-table.ts b/ide/src/base-ui/table/lit-table.ts index f485b256302420fecd083b2a3dc5167bae674458..dfc1d337cab76de3c18ee73dd10b5c3a5c879e9a 100644 --- a/ide/src/base-ui/table/lit-table.ts +++ b/ide/src/base-ui/table/lit-table.ts @@ -67,7 +67,7 @@ export class LitTable extends HTMLElement { private _mode = TableMode.Expand; private columnResizeEnable: boolean = true; private _isSearch: boolean = false; - private maxLength: number = 0; + private maxLength: number = 0; constructor() { super(); @@ -166,11 +166,13 @@ export class LitTable extends HTMLElement { set recycleDataSource(value) { // 处理数据按小数点位置对齐 - if (value && value.length) { + if (value && value.length) { // 找出数字部分的最大长度 - value.forEach((item: any) => { - // 提取数字部分(包括小数点) + value.forEach((item: unknown) => { + // 提取数字部分(包括小数点) + // @ts-ignore if (item.durFormat) { + // @ts-ignore const match = item.durFormat.match(/^(\d+(\.\d+)?)/); if (match && match[1]) { // 计算长度(包括小数点) @@ -178,14 +180,16 @@ export class LitTable extends HTMLElement { this.maxLength = Math.max(this.maxLength, length); } } - if (item.percent) { - const match = item.percent.match(/^(\d+(\.\d+)?)/); + // @ts-ignore + if (item.percent) { + // @ts-ignore + const match = item.percent.match(/^(\d+(\.\d+)?)/); if (match && match[1]) { const length = match[1].length; this.maxLength = Math.max(this.maxLength, length); } - } - }) + } + }); } if (this.tableElement) { this.isScrollXOutSide = this.tableElement!.scrollWidth > this.tableElement!.clientWidth; @@ -1611,23 +1615,23 @@ export class LitTable extends HTMLElement { // 提取数字部分(包括小数点) if (dataIndex === 'durFormat') { // @ts-ignore - const match = text.match(/^(\d+(\.\d+)?)(.*)$/); - if (match && match[1] && match[3]) { - // 计算需要添加的空格数 - const padding = '\xa0\xa0'.repeat(this.maxLength - match[1].length); - // 构造新的durFormat字符串 - text = padding + match[1] + match[3]; - } + const match = text.match(/^(\d+(\.\d+)?)(.*)$/); + if (match && match[1] && match[3]) { + // 计算需要添加的空格数 + const padding = '\xa0\xa0'.repeat(this.maxLength - match[1].length); + // 构造新的durFormat字符串 + text = padding + match[1] + match[3]; + } + } + if (dataIndex === 'percent') { + // @ts-ignore + const match = text.match(/^(\d+(\.\d+)?)(.*)$/); + if (match && match[1]) { + const padding = '\xa0\xa0'.repeat(this.maxLength - match[1].length); + text = padding + match[1]; } - if(dataIndex === 'percent'){ - // @ts-ignore - const match = text.match(/^(\d+(\.\d+)?)(.*)$/); - if (match && match[1]) { - const padding = '\xa0\xa0'.repeat(this.maxLength - match[1].length); - text = padding + match[1]; - } - } - } + } + } //@ts-ignore (child as HTMLElement).innerHTML = text; } //@ts-ignore diff --git a/ide/src/trace/component/setting/SpHisysEvent.ts b/ide/src/trace/component/setting/SpHisysEvent.ts index 59e84f44c106a638151cbd6adb98914526e852f4..14e60f748a82ffbe5d4ec1af62d41f182d4b2897 100644 --- a/ide/src/trace/component/setting/SpHisysEvent.ts +++ b/ide/src/trace/component/setting/SpHisysEvent.ts @@ -95,11 +95,11 @@ export class SpHisysEvent extends BaseElement { } domainInputEvent = (): void => { - if(this.startSamp){ + if (this.startSamp) { if (SpRecordTrace.serialNumber === '') { this.domainInputEL!.dataSource([], ''); } else { - HdcDeviceManager.fileRecv(this.sysEventConfigPath, () => {}).then((pullRes) => { + HdcDeviceManager.fileRecv(this.sysEventConfigPath, () => { }).then((pullRes) => { pullRes.arrayBuffer().then((buffer) => { if (buffer.byteLength > 0) { let dec = new TextDecoder(); @@ -122,7 +122,7 @@ export class SpHisysEvent extends BaseElement { }; nameInputEvent = (): void => { - if(this.startSamp){ + if (this.startSamp) { if (SpRecordTrace.serialNumber === '') { this.eventNameInputEL!.dataSource([], ''); } else { @@ -131,7 +131,7 @@ export class SpHisysEvent extends BaseElement { let eventConfigElement = this.eventConfig[domain]; if (eventConfigElement) { let eventNameList = Object.keys(eventConfigElement); - if (eventNameList?.length > 0 ) { + if (eventNameList?.length > 0) { this.eventNameInputEL!.dataSource(eventNameList, 'ALL-Event'); } else { this.eventNameInputEL!.dataSource([], '');