Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Issue 342 - Add column type support for conditionals #343

Merged
merged 3 commits into from
Feb 11, 2019

Conversation

Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Jan 23, 2019

As part of epic #166 and follow up to type support #297.
Fixes #342

Adds type support for conditionals.

@Marc-Andre-Rivet
Copy link
Contributor Author

As mentioned by @alexcjohnson, style_data_conditional is missing filter in the prop types

@Marc-Andre-Rivet
Copy link
Contributor Author

Marc-Andre-Rivet commented Jan 24, 2019

I'll also use the occasion to add a few more visual tests for the existing conditionals.

One thing that that might be of interest is the style resolution logic that's going on behind the scene. For example, a data cell will apply all matching static and conditional styles, overriding previously set values in this order

static cell styles --> conditional cell styles --> static data cell styles --> conditional data cell styles

Styles defined at a higher index in the conditional arrays have precedence over the styles defined before.
So if for some given data cell the follow apply:

static_cell { backgroundColor: 'red' }
conditional cell { backgroundColor: 'blue', color: 'white' }
static data { color: 'black' }
conditional data [{ backgroundColor: 'yellow', color: 'red', fontFamily: 'cursive' }, { backgroundColor: 'orange', fontFamily: 'serif' }]

The final result will be { backgroundColor: 'orange', color: 'red', fontFamily: 'serif' }

The same logic applies to header and filter cells and is located in:

The style merging priority is the same opposite of the priority when selecting dropdowns and tooltips -- maybe we can discuss if it would make sense to invert the behavior of those props so as to behave like the styles (e.g. last defined as priority instead of first defined). Both behavior are fine in isolation but the combination of two priority schemes that essentially contradict each other isn't exactly great at the API level.

Marc-André Rivet added 2 commits February 11, 2019 14:03
…-type-filtering

# Conflicts:
#	src/dash-table/derived/style/index.ts
#	src/dash-table/derived/style/props.ts
- update static_data_conditional nested props
@Marc-Andre-Rivet
Copy link
Contributor Author

@alexcjohnson I think this is ready to be looked at again. Since last update:

  • confirmed or modified dropdown and tooltip selection to choose the last one defined in the list, matching the priority for styles
  • added visual tests
  • added filter nested prop to the prop types of style_data_conditional -- no additional change required as the TS code already supported it

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

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

LGTM! 💃

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit 04c388d into master Feb 11, 2019
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the 3.1-issue342-column-type-filtering branch February 11, 2019 20:42
@Marc-Andre-Rivet Marc-Andre-Rivet changed the title Issue 342- Add column type support for conditionals Issue 342 - Add column type support for conditionals Feb 13, 2019
@andreaallegra
Copy link

hello,
which are the current possibilities of filter string in dropdowns header of the column_conditional_dropdowns?
Thank you

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow filter conditions to use column type
4 participants