-
Notifications
You must be signed in to change notification settings - Fork 77
fix(table): fix sorting, column width calculation, and text wrapping #253
Conversation
Codecov Report
@@ Coverage Diff @@
## master #253 +/- ##
=======================================
Coverage 37.99% 37.99%
=======================================
Files 12 12
Lines 229 229
Branches 21 21
=======================================
Hits 87 87
Misses 132 132
Partials 10 10 Continue to review full report at Codecov.
|
function getText(value: unknown, format: TimeFormatter | NumberFormatter | undefined) { | ||
let formattedValue = value; | ||
if (format) { | ||
formattedValue = format.format(value as any); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return here? If there is a format
function, that should not produce html output.
let formattedValue = value; | ||
if (format) { | ||
formattedValue = format.format(value as any); | ||
} | ||
if (typeof value === 'string') { | ||
const span = document.createElement('span'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another new trick I learn is using regex to remove all html tags.
I think it should be faster than parsing html via span
tag, although haven't really tested it.
const htmlTagRegex = /(<([^>]+)>)/gi;
const text = value.replace(htmlTagRegex, '');
Deploy preview for superset-ui-plugins ready! Built with commit 403dbf8 |
…erset#253) Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.108 to 4.14.147. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash) Signed-off-by: dependabot-preview[bot] <[email protected]>
…pache-superset#253) * fix(table): fix issues * fix(table): fix comments
💔 Breaking Changes
🏆 Enhancements
📜 Documentation
🐛 Bug Fix
This PR is to
better calculation of the column width (with formatted string);
![image](https://user-images.githubusercontent.com/2024960/68719139-1d03a980-0560-11ea-87b8-e52c7ad854e8.png)
lexicographically sorting strings;
![image](https://user-images.githubusercontent.com/2024960/68719152-2725a800-0560-11ea-865e-7372930fa270.png)
fixing word truncating issues;
![image](https://user-images.githubusercontent.com/2024960/68719172-33aa0080-0560-11ea-9c79-81f9eeb95be5.png)
🏠 Internal
cc: @etr2460 @graceguo-supercat