mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:58:05 +08:00
fix: 修复 input-excel 在二维数据模式下 plainText 属性不生效问题 (#7065)
This commit is contained in:
parent
afada192bb
commit
30a42fdd3e
@ -270,8 +270,25 @@ export default class ExcelControl extends React.PureComponent<
|
||||
|
||||
if (parseMode === 'array') {
|
||||
worksheet.eachRow((row: any, rowNumber: number) => {
|
||||
const values = row.values;
|
||||
let values = row.values;
|
||||
values.shift(); // excel 返回的值是从 1 开始的,0 节点永远是 null
|
||||
if (plainText) {
|
||||
values = values.map((item: any) => {
|
||||
if (item instanceof Object) {
|
||||
if (item.hyperlink) {
|
||||
if (item.hyperlink.startsWith('mailto:')) {
|
||||
return item.hyperlink.substring(7);
|
||||
}
|
||||
return item.hyperlink;
|
||||
} else if (item.result) {
|
||||
return item.result;
|
||||
} else if (item.richText) {
|
||||
return this.richText2PlainString(item);
|
||||
}
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
result.push(values);
|
||||
});
|
||||
return result;
|
||||
@ -305,9 +322,7 @@ export default class ExcelControl extends React.PureComponent<
|
||||
} else if (cell.type === ExcelValueType.Formula) {
|
||||
value = cell.value.result;
|
||||
} else if (cell.type === ExcelValueType.RichText) {
|
||||
value = cell.value.richText
|
||||
.map((item: any) => item.text)
|
||||
.join('');
|
||||
value = this.richText2PlainString(cell.value);
|
||||
} else if (cell.type === ExcelValueType.Error) {
|
||||
value = '';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user