Skip to content

fix(AnalyticalTable): Each column can have groupable, sortable, filte… #264

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

Merged
merged 5 commits into from
Jan 15, 2020

Conversation

gnseo
Copy link
Contributor

@gnseo gnseo commented Jan 13, 2020

fix(AnalyticalTable): Each column can have groupable, sortable, filterable options

@claassistantio
Copy link

claassistantio commented Jan 13, 2020

CLA assistant check
All committers have signed the CLA.

@MarcusNotheis MarcusNotheis self-requested a review January 13, 2020 07:49
Copy link
Contributor

@MarcusNotheis MarcusNotheis left a comment

Choose a reason for hiding this comment

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

Hi @iamuan,
thanks for submitting this PR, great idea to add this feature on column level!
Could you please update the code to use the NullishCoalesingOperator instead of the 'manual' undefined check? This would increase the readability in my opinion.

Thanks!

@gnseo
Copy link
Contributor Author

gnseo commented Jan 13, 2020

Hi, @MarcusNotheis.

As we know, the "undefined" usually means the property or argument is not provided by the caller.

So I thought it's better that if the property is not provided at column level, then the property at table level should be considered.

For increasing readability, how about add getProvidedArgument function like below.

function getProvidedArgument(...args){
  return args.reduce((result,arg)=>{
    if(arg !== undefined && result !== undefined){
      result = arg;
    }
    return result;
  },undefined)
}

groupable={getProvidedArgument(column.groupable, props.groupable)}
sortable={getProvidedArgument(column.sortable, props.sortable)}

@MarcusNotheis
Copy link
Contributor

MarcusNotheis commented Jan 13, 2020

Hi @iamuan ,
the nullish-coalescing-operator is used for exaclty this type of issue:

The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand. (MDN).

So it is basically the same as the function you proposed, but JS-native and handling null as well. What would be the downside of using it? Do you have any objections?

@gnseo
Copy link
Contributor Author

gnseo commented Jan 14, 2020

Hi, @MarcusNotheis .

I think the "undefined" and "null" have different meanings.
When we recognize if a property is provided from caller, usually check if it is "undefined".
And in my opinion, the priority of each property should be considered by this standard.

But also It's up to your choice, I would follow that.
Please leave a comment for this, I'll fix as your decision.

Thanks.

@MarcusNotheis
Copy link
Contributor

Hi @iamuan ,

I see your point, but I would still go for the nullish-coalescing option. (We have the same pattern in some other places in the library, so if we would change it here we would have to adopt in all other places as well).
Thanks for your contribution!

@codecov-io
Copy link

codecov-io commented Jan 15, 2020

Codecov Report

Merging #264 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #264   +/-   ##
======================================
  Coverage    73.9%   73.9%           
======================================
  Files         161     161           
  Lines        3533    3533           
  Branches      613     613           
======================================
  Hits         2611    2611           
  Misses        720     720           
  Partials      202     202
Impacted Files Coverage Δ
packages/main/src/webComponents/Token/index.tsx 100% <ø> (ø) ⬆️
packages/base/src/Device/Media.ts 76.85% <ø> (ø) ⬆️
packages/main/src/webComponents/Title/index.tsx 100% <ø> (ø) ⬆️
...kages/main/src/webComponents/RadioButton/index.tsx 100% <ø> (ø) ⬆️
packages/main/src/webComponents/List/index.tsx 100% <ø> (ø) ⬆️
...ges/main/src/webComponents/BusyIndicator/index.tsx 100% <ø> (ø) ⬆️
...kages/main/src/webComponents/TableColumn/index.tsx 100% <ø> (ø) ⬆️
...ckages/main/src/webComponents/DatePicker/index.tsx 100% <ø> (ø) ⬆️
...nalyticalTable/virtualization/VirtualTableBody.tsx 84% <ø> (ø) ⬆️
...ckages/base/src/Scroller/ScrollContextProvider.tsx 100% <ø> (ø) ⬆️
... and 93 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 95f41e2...8bb13d1. Read the comment docs.

Copy link
Contributor

@MarcusNotheis MarcusNotheis left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for your contribution!

@MarcusNotheis MarcusNotheis merged commit 7e8c01f into SAP:master Jan 15, 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.

4 participants