This commit is contained in:
Jan Prochazka
2024-08-26 09:32:28 +02:00
parent eaa943a39d
commit 4cbfa7c937
5 changed files with 33 additions and 29 deletions

View File

@@ -150,7 +150,7 @@ export function stringifyCellValue(
if (value === true) return { value: 'true', gridStyle: 'valueCellStyle' };
if (value === false) return { value: 'false', gridStyle: 'valueCellStyle' };
if (editorTypes?.parseHexAsBuffer) {
if (value?.type == 'Buffer' && _isArray(value.data)) {
return { value: '0x' + arrayToHexString(value.data), gridStyle: 'valueCellStyle' };
@@ -167,28 +167,26 @@ export function stringifyCellValue(
}
}
}
if (editorTypes?.parseJsonArray) {
if (_isArray(value)) {
switch (intent) {
case 'gridCellIntent':
return stringifyJsonToGrid(value);
case 'multilineEditorIntent':
return { value: JSON.stringify(value) };
default:
return { value: JSON.stringify(value, null, 2), gridStyle: 'valueCellStyle' };
}
if (_isArray(value)) {
switch (intent) {
case 'gridCellIntent':
return stringifyJsonToGrid(value);
case 'multilineEditorIntent':
return { value: JSON.stringify(value, null, 2) };
default:
return { value: JSON.stringify(value), gridStyle: 'valueCellStyle' };
}
}
if (editorTypes?.parseJsonObject) {
if (_isPlainObject(value)) {
switch (intent) {
case 'gridCellIntent':
return stringifyJsonToGrid(value);
case 'multilineEditorIntent':
return { value: JSON.stringify(value) };
default:
return { value: JSON.stringify(value, null, 2), gridStyle: 'valueCellStyle' };
}
if (_isPlainObject(value)) {
switch (intent) {
case 'gridCellIntent':
return stringifyJsonToGrid(value);
case 'multilineEditorIntent':
return { value: JSON.stringify(value, null, 2) };
default:
return { value: JSON.stringify(value), gridStyle: 'valueCellStyle' };
}
}