-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(checkbox): Adds a checkbox option to columns #484
Conversation
@attribute | ||
type = 'checkbox'; | ||
|
||
@argument({ defaultIfUndefined: true }) |
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 its value defaulted to be false?
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.
Yeah, I think so
}; | ||
} | ||
|
||
selectRow = (rowIndex, { toggle, range }) => { | ||
let rows = this.get('rows'); |
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.
You might want handle SELECTION_MODE_NONE
here
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.
check tests, SELECTION_MODE_NONE is simply not adding an action for onSelect
tests/helpers/generate-table.js
Outdated
|
||
const alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
|
||
function hex(a) { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool to me. I would not block the PR because of this.
tests/helpers/generate-table.js
Outdated
return s; | ||
} | ||
|
||
const fullTable = hbs` |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
Sounds good to me
👍 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