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

Row z-index and a column resizer double click callback #189

Closed
wants to merge 24 commits into from

Conversation

jeremyk
Copy link

@jeremyk jeremyk commented Jul 5, 2017

Description

Row z-index change: we remove the style= z-index so that it can be set with CSS based on a selected row class.
We added a callback for double clicking the resizer
We added a showBottomBorder on all rows props.

Motivation and Context

Row z-index changes:

  • We wanted excel style drag down but the "handle" in the corner would be cut off by the row below. There was no easy way to fix that without making it so that the currently selected row would have a higher z-index.
    -In the process I removed what seemed to be an unnecessary wrapping component: FixedDataTableRowImpl but I can put it back if it had a purpose I didn't understand. My general impression is that FDT2 has more of these than necessary so I started moving in that direction.

Column resizer: so could allow the column to auto size to its contents (like excel).

ShowBottomBorder: we couldn't get the bottom border on the last row in short tables to show.

How Has This Been Tested?

We are using this extensively in a private project that has a full QA team.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x ] My code follows the code style of this project.
  • [x ] My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [x ] I have read the CONTRIBUTING document.

NOTE: I have not updated the documentation and I did commit to the dist folder. I'm not really sure how we could use this ourselves easily if I didn't do that (maybe someone can explain it to me?). There are also a couple other changes that probably need to be reverted for this to get reintegrated which I am happy to do but thought I would submit this PR first to just find out if these changes are wanted before I go to that trouble. Thanks.

Jeremy Kallman and others added 12 commits February 22, 2017 12:16
Allows drag handle to naturally sit over row below.
Rows reusal causes order to not matter.
-Setting style is hard to override so use classes.
-Remove wrapper that was preventing whole row z-index to be set based on selected row.
Use dist folder so we don't have to build internal.
Also, use better antialiasing method.
I had previously removed the row wrapper.
@wcjordan
Copy link
Member

wcjordan commented Jul 7, 2017

@KamranAsif could you take a look at this since you have the most extensive knowledge of issues related to row z-indexing? Also if you have some time I'd appreciate a primer on what we've dealt with in the past there.

@@ -17,6 +17,107 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
Copy link
Member

Choose a reason for hiding this comment

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

Can you revert all the changes to dist & main.js?

Copy link
Author

Choose a reason for hiding this comment

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

Yes

site/base.less Outdated
@@ -6,7 +6,7 @@ html, body {
-ms-text-size-adjust: 100%;
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-webkit-font-smoothing: subpixel-antialiased;
Copy link
Member

Choose a reason for hiding this comment

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

what was your motivation here? could you revert unless there's a good driver?

Copy link
Author

Choose a reason for hiding this comment

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

I will revert

Copy link
Author

Choose a reason for hiding this comment

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

BTW, I was looking at this some more and I kind of think this should just be removed all together: http://usabilitypost.com/2012/11/05/stop-fixing-font-smoothing/

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 it's worth filing an issue for it, but I don't think it relates to your changeset and alters the styling of the docs so I'd rather not block merge on time to research it.

If I'm missing something and it's related to the changeset though, let me know.

@@ -106,6 +106,11 @@ class FixedDataTableRowImpl extends React.Component {
* @param number distance
*/
onColumnReorderEnd: PropTypes.func,

/**
* Whether the row has a bottom borer accross it
Copy link
Member

Choose a reason for hiding this comment

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

nit border spelling

FixedDataTableTranslateDOMPosition(style, 0, this.props.offsetTop, this._initialRender);

return (
<div
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it's safe to remove this wrapping div. Could you add it back and we can revisit removing in a minor release.

Copy link
Author

Choose a reason for hiding this comment

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

Ok. I think I had a better reason but can't remember any more. I will put it back and see if my changes still work.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 please revert

Copy link
Author

Choose a reason for hiding this comment

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

Below, I noted that "the reason I removed the wrapping div is that the class needs to be added on the outer most div or it won't reorder the z-index of the row."

@@ -335,6 +345,7 @@ var FixedDataTable = createReactClass({
showScrollbarX: true,
showScrollbarY: true,
touchScrollEnabled: false,
showBorderOnAllRows: true,
Copy link
Member

Choose a reason for hiding this comment

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

This should be false by default

Copy link
Author

Choose a reason for hiding this comment

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

Yep. Will do

@@ -709,8 +721,15 @@ var FixedDataTable = createReactClass({
/*number|string*/ columnKey,
/*object*/ event
) {

var nowMs = Date.now();
if (this.state.lastColumnResizeStart && nowMs - this.state.lastColumnResizeStart < 500) {
Copy link
Member

Choose a reason for hiding this comment

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

can you pull the < 500 into a double click timeout const in this file?

Copy link
Author

Choose a reason for hiding this comment

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

Sure

@wcjordan
Copy link
Member

Kam's not available, so sorry for the wait. I've added some comments and think we can accept something like this (although I may strip it out in favor of #60 & #61).

I am seeing a lot of issues in the examples where headers & fixed columns are being overlapped by rows & scrollable columns when scrolling Y & X respectively. I'm also seeing an issue with the Resizable Columns example no longer working. Could you run npm run site-dev-server and fix the issues?

fixed_scroll_issue
header_issue

@wcjordan
Copy link
Member

wcjordan commented Aug 1, 2017

@jeremyk any update here? I'm going to cut a release shortly and wondering if I should wait on this.

@jeremyk
Copy link
Author

jeremyk commented Aug 1, 2017

Sorry, been on vacation and busy. The main update is that the reason I removed the wrapping div is that the class needs to be added on the outer most div or it won't reorder the z-index of the row. I thought I noted that here but it seems that I did not.

Anyway, if you are still interested I can get this cleaned up in a day - just let me know. Thanks!

@wcjordan
Copy link
Member

wcjordan commented Aug 1, 2017

Sure just depends on your priorities (there will always be more releases!). If you could give me an idea where you're at that will help me with deciding when to cut this weekend / Monday.

@jeremyk
Copy link
Author

jeremyk commented Aug 2, 2017

I will work on this tomorrow and if I don't finish I will give an update.

@jeremyk
Copy link
Author

jeremyk commented Aug 2, 2017

Ok, I made all the requested changes except restoring the wrapper as I need that for my z-index change. I also merged from upstream and resolved the conflicts.

@wcjordan
Copy link
Member

wcjordan commented Aug 2, 2017

Great thanks. I'll give this a look soon and ship it out w/ a release this weekend or so.

Since I plan to do a minor version bump, the wrapper change should be less risky than doing it on a patch bump

Copy link
Contributor

@KamranAsif KamranAsif left a comment

Choose a reason for hiding this comment

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

There is a lot going on here. Can you split this up into multiple reviews?

var nowMs = Date.now();
if (this.state.lastColumnResizeStart && nowMs - this.state.lastColumnResizeStart < DOUBLE_CLICK_TIMEOUT) {
(this.props.onColumnResizeDoubleClick || emptyFunction)(columnKey);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Theres no reason to re-invent the wheel here. You should have a separate callback passed that uses the native onDoubleClick event handler

Copy link
Author

Choose a reason for hiding this comment

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

On a double click you were getting 2 regular resize callbacks. I wasn't trying to "reinvent the wheel" I just thought it easier to handle it all at this point.

@@ -141,9 +141,15 @@ var FixedDataTableColumnResizeHandle = createReactClass({
},

_onMove(/*number*/ deltaX) {

if (deltaX === 0) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this actually change anything?

Copy link
Author

Choose a reason for hiding this comment

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

It basically stopped the resize callbacks when they were essentially noops. So it doesn't really do anything but I think it makes for a cleaner api.

@jeremyk
Copy link
Author

jeremyk commented Aug 11, 2017

I can certainly switch to an ondblclick and clean it up some more but I don't really want to keep working on this pull request if you guys don't really want it. My motivation is that we have a fork going and these are all the things that we need to switch back to the non-forked version. I think that is better for everyone but I also don't really want to split it up for that reason.

@wcjordan
Copy link
Member

We definitely do want to help merge you back to mainline, sorry if the feedback has come across as ungrateful.

The wrapping div issue may seem minor in your usage of FDT, but because FDT doesn't have a good system for styling components, a change like that can break the CSS styles of other users. So we need to carefully investigate if there are alternatives or hold off on a change like that until a major release like the upcoming redux one.

Also have you had a chance to look into the screenshot I posted?

@jeremyk
Copy link
Author

jeremyk commented Aug 11, 2017

Ok, hope I didn't come across as if I don't want to help because I do. But I was thrown a little off guard as you asked for a bunch of changes and I did them all and then a bunch more were asked for. Anyway, I did see your screenshot and I fixed the issues with that. I could possibly move the classes I need to the wrapper but one of my main thoughts on FDT is that it has too many wrappers (there are 3 divs around each row) that don't seem to have a purpose (maybe I just don't understand the purpose) so I was trying to help removing one. Also it is set up to add all the classes to the inner wrapper so it seemed like a bunch of work to change how the outer wrapper was set up for minimal gain. I am adding a couple screenshots to help visualize this change.
after
before

@wcjordan
Copy link
Member

Totally agree that there are unnecessary wrappers on divs, and we'd like to clean them up. Unfortunately with libraries, even small things like that can break compatibility.

If you think you can make a pass at keeping it in place that will allow releasing this sooner. Then filing a follow up ticket to reduce the wrappers can be targeted for the v1 release.

Either way let me know where you end up and I can adjust so it gets merged to the right place.
Thanks!

@wcjordan
Copy link
Member

wcjordan commented May 4, 2020

Closing this PR as stale.

@wcjordan wcjordan closed this May 4, 2020
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.

3 participants