From bc5d9393715a1f094a88ddbc1834bfdeed381788 Mon Sep 17 00:00:00 2001 From: Franco Gervasi Date: Tue, 28 Mar 2023 13:33:24 +0200 Subject: [PATCH 1/2] If number is NaN then write empty string to cell --- dist/routes.js | 9 +++++++++ src/helpers/data.ts | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/dist/routes.js b/dist/routes.js index 28572442..8ae4479e 100644 --- a/dist/routes.js +++ b/dist/routes.js @@ -149,6 +149,15 @@ function formatCell(rawValue, type, useGroupingSeparator = false) { return formatCountryFlagEmojiDatapoint(rawValue); } const parsedRawValue = parseFloat(rawValue || ''); + if (isNaN(parsedRawValue)) { + return { + type: 'text', + value: parsedRawValue, + label: '', + footnote: '', + classes: [''], + }; + } let prefix = ''; let separator = ''; if (useGroupingSeparator) { diff --git a/src/helpers/data.ts b/src/helpers/data.ts index 23ed554b..53f7ec78 100644 --- a/src/helpers/data.ts +++ b/src/helpers/data.ts @@ -133,6 +133,15 @@ function formatCell(rawValue: QTableCellDataRaw, type: FormattingType, useGroupi } const parsedRawValue = parseFloat(rawValue || ''); + if(isNaN(parsedRawValue)) { + return { + type: 'text', + value: parsedRawValue, + label: '', + footnote: '', + classes: [''], + } + } let prefix = ''; From 22a9e2b174b1bfd30fdfcc0c0242130786baa6e7 Mon Sep 17 00:00:00 2001 From: Franco Gervasi Date: Tue, 28 Mar 2023 13:35:28 +0200 Subject: [PATCH 2/2] Update package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a72cc408..d4e1b4eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "q-table", - "version": "7.2.4", + "version": "7.2.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "q-table", - "version": "7.2.4", + "version": "7.2.5", "license": "MIT", "dependencies": { "@hapi/boom": "^10.0.0", diff --git a/package.json b/package.json index 229b6022..9b922b2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "q-table", - "version": "7.2.4", + "version": "7.2.5", "description": "", "main": "index.js", "type": "module",