Skip to content
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

Allow row selection in fixed tables #23

Merged
merged 8 commits into from
Jul 4, 2017
Merged

Allow row selection in fixed tables #23

merged 8 commits into from
Jul 4, 2017

Conversation

AdamWard1995
Copy link
Contributor

This project uses semver, please check the scope of this pr:

  • #none# - documentation fixes and/or test additions
  • #patch# - backwards-compatible bug fix
  • #minor# - adding functionality in a backwards-compatible manner
  • #major# - incompatible API change

Add functionality for selecting table rows to frost-fixed-table. Needed for an internal story.

CHANGELOG

  • Added functionality for selecting table rows in frost-fixed-table

@AdamWard1995
Copy link
Contributor Author

Realized that I left changes in the demo I didn't want to, will remove those

@@ -20,12 +21,29 @@ export default Component.extend({
// == PropTypes =============================================================

propTypes: {
// required:
// options:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to rename this? Consistency with other existing components?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, consistency with frost-table

@@ -76,6 +99,17 @@ export default Component.extend({
@readOnly
@computed('css')
/**
* The selector for the left header DOM element
* @param {String} css - the base css class name for the component
* @returns {String} a sutiable jQuery selector for the left section of the table header
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo suitable?


@readOnly
@computed('css')
/**
* The selector for the middle header DOM element (specifically the scroll wrapper)
* @param {String} css - the base css class name for the component
* @returns {String} a sutiable jQuery selector for the middle section of the table header
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo suitable?

/**
* The selector for the right header DOM element
* @param {String} css - the base css class name for the component
* @returns {String} a sutiable jQuery selector for the right section of the table header
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo suitable?

* @param {String} css - the base css class name for the component
* @returns {String} a sutiable jQuery selector for the left section of the table header
*/
headerLeftSelector (css) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we exposing this CP to the consumer? I'm simply wondering because there is an inconsistency in naming CP _ vs no _ for internal CPs. No big deal I'm simply wondering.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ is a valid comment for all other CPs

/**
* Set up synced scrolling as well as calculating padding for middle sections
*/
didRender () {
this._super(...arguments)
this.setupBodyHeights()
this.setupHoverProxy()
this.setupLeftAndRightWidths() // Needs to happen before setting up middle section
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to the selection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding in the checkboxes column misaligns the columns BAD

const clonedSelectedItems = A(this.get('selectedItems').slice())
const _rangeState = this.get('_rangeState')

// Selects are proccessed in order of precedence: specific, range, basic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be isolated in a util since it can be common.

@@ -65,6 +65,11 @@ export default Component.extend({

// == DOM Events ============================================================

click (event) {
event.stopPropagation()
this.$().find('.frost-table-row-selection').trigger('click')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simply trigger consumer action? (not sure here I'm simply wondering)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So frost-table-row when you enable selection adds an frost-table-row-selection to the row. It is within the click event handler of frost-table-row-selection that the onSelect callback is call, thought it would be simplist to just trigger this event

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we doing an action on click for the table on when we click on a button or something like that (similar to list)? If we are using a button to do an action based on selection then we should use a similar implementation to the list and I'm not seeing anything like this in the list.

@@ -31,8 +31,10 @@
hook=(concat hookPrefix '-header-left')
hookQualifiers=hookQualifiers
tagName='div'
isSelectable=_isSelectable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can select the header? For sorting I'm expecting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done in frost-table, for sorting was my guess as well but will look a little deeper to confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for sorting, this is how the header knows to add in a column in header that corresponds to the checkbox column


// sass-lint:disable nesting-depth
.frost-table-row {
&.is-selected {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using is-selected in the list for selection? It will be nice to use the same class name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

.travis.yml Outdated
@@ -17,7 +17,6 @@ addons:

cache:
directories:
- node_modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdamWard1995 why? This does not follow the practice of any of our other repos /cc @juwara0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@notmessenger - is correct. Please do not remove the caching.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He's trying to figure out why something isn't working, and needed to clear the cache. It should be temporary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to add it back, just clearing it as locally everything is installing fine :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That setting tells travis that it can cache the node_modules directories during builds. https://docs.travis-ci.com/user/caching/#Caching-directories-(Bundler%2C-dependencies). If you need to clear the cache during CI there is an option to do so on the build page under the drop-down in the upper right corner.

@@ -24,8 +24,6 @@ module.exports = function (defaults) {

if (app.env === 'test') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of this code

  if (app.env === 'test') {
    ;[
    ].forEach((path) => {
      app.import(path, {type: 'test'})
    })
  }

needs to be removed as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 28901f7 on AdamWard1995:fixedTableSelection into ** on ciena-frost:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 49b0844 on AdamWard1995:fixedTableSelection into ** on ciena-frost:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a75f7ea on AdamWard1995:fixedTableSelection into ** on ciena-frost:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 461689f on AdamWard1995:fixedTableSelection into ** on ciena-frost:master**.

@dafortin
Copy link
Member

dafortin commented Jul 4, 2017

Looks good :) 👍

@dafortin dafortin merged commit 06b8646 into ciena-frost:master Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants