Comments (3)
I'd have to review, but I believe in cli-table2
it's a pretty naive implementation that does a merge of the default config, the table config, the the cell config using merge
(listed in order of increasing importance).
The way cli-table
works is that each cell is responsible for rendering it's own top and left edges. Only cells in the last column render their right edge. Only cells in the last row render their bottom edge. This does not make for very convenient custom characters at the cell level. If you want to change the bottom / right edge of a particular cell, you actually need to find the neighbor responsible for that and set the value there. It would be better if, when deciding what character to use for it's own left edge, a cell checked first for a custom left
character in it's own config, if not, check for a custom right
character in the config of it's neighbor, and followed by the left
character as configured at the table level, followed by the default.
Corners get even more interesting (who gets to take precedence).
I'm not sure how necessary "custom chars" really are. It might be better just to offer the ability to make certain lines "double" or "heavy".
box-chars
box-chars helps pick the correct character for a given edge or intersection
For a standard top left corner character (a character that points down, and to the right), you find it as follows:
var box = require('box-chars');
var left = box.NOTHING; // nothing pointing to the left from top-left corner
var right = box.LIGHT; // other options are HEAVY or DOUBLE
var up = box.NOTHING; // nothing pointing up
var down = box.LIGHT;
box(left, right, up, down);
//=> โ
for situations that do not exist (i.e. right=LIGHT, left=DOUBLE
), it picks a sensible default (DOUBLE
, DOUBLE
in that case).
box-chars
is not documented, but it is well tested.
from table.
@gajus
Added you as collaborator on box-chars
, if you think it's worthwhile for table
, run with it. I haven't touched it in a while
from table.
I thought about this and consider this feature to be too much of an edge case. Very few packages will use this feature and it will add a considerable level of complexity to the existing code. As such, it will not be implemented.
from table.
Related Issues (20)
- SyntaxError: Invalid regular expression: /(^.{1,0}(\s+|$))|(^.{1,-1}(\\|/|_|\.|,|;|-))/: numbers out of order in {} quantifier HOT 1
- Custom space character HOT 1
- update string-width please HOT 2
- Replace `lodash.clonedeep` and `lodash.truncate` to `lodash` HOT 3
- Merging cells HOT 2
- Drop Node.js 10 HOT 1
- The automated release is failing ๐จ HOT 4
- Module cannot be found error HOT 2
- [bug] package.json main points to wrong location HOT 3
- Warning in DevTools about missing source maps HOT 2
- Allow access to header.content HOT 4
- Headers in Table don't calculate the size correctly if using emoticons like "๐งช"
- Alignment is not working HOT 3
- SpanningCells API example causes TS error HOT 2
- Chalk breaks table structure when used with cell spanning.
- Render tables side by side?
- When using truncate, table borders are coloured the same as the cell content.
- (Question) auto adjust width HOT 2
- utils.flatten is prone to stack overflow
- Performance issue with large tables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from table.