feat(checkbox): Adds a checkbox option to columns#484
Conversation
| @attribute | ||
| type = 'checkbox'; | ||
|
|
||
| @argument({ defaultIfUndefined: true }) |
There was a problem hiding this comment.
Should its value defaulted to be false?
| } | ||
|
|
||
| selectRow = (rowIndex, { toggle, range }) => { | ||
| let rows = this.get('rows'); |
There was a problem hiding this comment.
You might want handle SELECTION_MODE_NONE here
There was a problem hiding this comment.
check tests, SELECTION_MODE_NONE is simply not adding an action for onSelect
|
|
||
| const alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
|
|
||
| function hex(a) { |
There was a problem hiding this comment.
This function looks complicated. If I am not wrong, you are trying to convert a number to Excel style alphabet index. Can you use simpler function in tests?
There was a problem hiding this comment.
I copied this from online somewhere, I’m sure there’s a lib somewhere. The point is it’s converting us to base26 instead of just modulo, so each cell is verifiably unique.
There was a problem hiding this comment.
Can you use simpler method here? Like using "Cell" + the input number itself if you want to identify each cell.
This function takes me a while to figure what it does. If there is a bug, it's hard to debug. This is for testing purpose and we do not really need complicated function.
There was a problem hiding this comment.
we need to identify each cell by row and column, which is a change I made to the testing template as well. You can't just check that a cell has content A, it need to be 1A or 2A or 3A or 1AA, so on.
Alternatively, we can try to have some longer content such as Row1Column1 to check against, this just seemed simpler (I just googled base26 and copied stack overflow). We can also try to see if there's a Node library that does this, it should be very standard.
There was a problem hiding this comment.
There was a problem hiding this comment.
Looks like there isn't an AMD build yet so unfortunately we can't use it 😕 I really don't think it's that big a deal, it's a simple function unlikely to have bugs.
There was a problem hiding this comment.
Cool to me. I would not block the PR because of this.
| return s; | ||
| } | ||
|
|
||
| const fullTable = hbs` |
There was a problem hiding this comment.
There are many duplication of this helper file and the ones in test-scenario. Can you merge them?
There was a problem hiding this comment.
That’s the plan! The APIs are different so I didn’t want to block this PR on them, the next one will be cleanup and expand tests in general, then Tree model refactors
|
👍 General approach looks good. Just need some clean up |
|
I tried out this branch and got an error: |
2e019d9 to
b256ec2
Compare
Adds a checkbox option to table columns which can be used to toggle the row. Also refactors row selection to be DDAU, and adds tests and creates a simpler generateTable function
b256ec2 to
ba11b76
Compare
Adds a checkbox option to table columns which can be used to toggle the row.
Also refactors row selection to be DDAU, and adds tests and creates a simpler
generateTable function