-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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] allow for multiple value column type #1666
Open
crabatel
wants to merge
17
commits into
keplergl:master
Choose a base branch
from
datatlas-erasme:add-multiple-value-column
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a1cefa9
[Feat] allow for multiple value column type
crabatel 0ee098f
[Fix] Remove react and react-dom from devDependencies to allow npm link
crabatel bfb12f1
Add dist build for tests
crabatel 944d37d
Update npmpublish.yml
Pipazoul 9a2e929
Update npmpublish.yml
Pipazoul 994ed49
Update package.json
Pipazoul 0c3dcb4
FIX changes icon.json url
Pipazoul fa9ffd3
Update package.json
Pipazoul f51f6e7
Update package.json
Pipazoul 49bdadd
FIX icon url
Pipazoul b800a54
Merge branch 'add-multiple-value-column' of https://github.com/datatl…
Pipazoul 5e45e73
Delete dist directory
Pipazoul 9f4ff24
revert npmpublish.yml file
Pipazoul 7f382d6
revert package.json
Pipazoul 32bb467
revert default-setting.js
Pipazoul de75a33
revert icon-layer.js
Pipazoul 842b667
revert constants.js
Pipazoul File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ name: Node.js Package | |
on: | ||
release: | ||
types: [created] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-npm: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,6 +329,7 @@ export function getFilterProps(field, fieldDomain) { | |
gpu: false | ||
}; | ||
|
||
case ALL_FIELD_TYPES.array: | ||
case ALL_FIELD_TYPES.string: | ||
case ALL_FIELD_TYPES.date: | ||
return { | ||
|
@@ -413,7 +414,13 @@ export function getFilterFunction(field, dataId, filter, layers) { | |
case FILTER_TYPES.range: | ||
return data => isInRange(valueAccessor(data), filter.value); | ||
case FILTER_TYPES.multiSelect: | ||
return data => filter.value.includes(valueAccessor(data)); | ||
return data => { | ||
const value = valueAccessor(data); | ||
if (Array.isArray(value)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make this function more efficient, we should do the checking out side the case FILTER_TYPES.multiSelect:
return feld.type === ALL_FILED_TYPES.array ? data => {
const value = valueAccessor(data);
return Array.isArray(value) && value.some(v => filter.value.includes(v));
} : data => filter.value.includes(valueAccessor(data)); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed it's better, I'll update this one. |
||
return value.some(v => filter.value.includes(v)); | ||
} | ||
return filter.value.includes(value); | ||
}; | ||
case FILTER_TYPES.select: | ||
return data => valueAccessor(data) === filter.value; | ||
case FILTER_TYPES.timeRange: | ||
|
@@ -941,6 +948,7 @@ export function mergeFilterDomainStep(filter, filterProps) { | |
}; | ||
|
||
switch (filterProps.fieldType) { | ||
case ALL_FIELD_TYPES.array: | ||
case ALL_FIELD_TYPES.string: | ||
case ALL_FIELD_TYPES.date: | ||
return { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
any reason why this is removed?
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.
Hello,
Actually I removed this because I thought having react as a dependency there was the cause of an error when trying to
npm link
the Kepler package (@see https://stackoverflow.com/questions/66975613/error-invalid-hook-call-hooks-can-only-be-called-inside-of-the-body-of-a-funct), but it appeared it wasn't the reason as we could not get rid of this error.As we could not
npm link
we resolved to pushing thedist/
folder on our repo and updating our dependency to point to our repo, hence the presence of thedist/
folder.Concerning this PR, we were not sure it could be accepted as we made the assumption that an array typed column in the CSV would be in a JSON format. This is the format we decided to use for our project, but it may not be the case for everyone, and maybe it should be discussed.
If the changes can be accepted, I'll remove the
dist/
from this branch as well as the dependency change.