Skip to content

Commit

Permalink
Fix faceting first
Browse files Browse the repository at this point in the history
  • Loading branch information
emeeks committed May 9, 2020
1 parent f3c1d61 commit 9bc9049
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "semiotic",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"description": "The semiotic JavaScript data visualization framework",
"main": "lib/index.js",
"unpkg": "dist/semiotic.min.js",
Expand Down Expand Up @@ -231,4 +231,4 @@
"eslintConfig": {
"extends": "react-app"
}
}
}
33 changes: 12 additions & 21 deletions src/components/FacetController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import * as React from "react"
import memoize from "memoize-one"

import {
xyframeproptypes,
ordinalframeproptypes,
networkframeproptypes,
responsiveprops
} from "./constants/frame_props"

Expand All @@ -14,15 +11,15 @@ import { XYFrameProps } from "./types/xyTypes"
import { CustomHoverType } from "./types/annotationTypes"

const framePropHash = {
NetworkFrame: networkframeproptypes,
XYFrame: xyframeproptypes,
OrdinalFrame: ordinalframeproptypes,
ResponsiveNetworkFrame: { ...networkframeproptypes, ...responsiveprops },
ResponsiveXYFrame: { ...xyframeproptypes, ...responsiveprops },
ResponsiveOrdinalFrame: { ...ordinalframeproptypes, ...responsiveprops },
SparkNetworkFrame: { ...networkframeproptypes },
SparkXYFrame: { ...xyframeproptypes },
SparkOrdinalFrame: { ...ordinalframeproptypes }
NetworkFrame: true,
XYFrame: true,
OrdinalFrame: true,
ResponsiveNetworkFrame: true,
ResponsiveXYFrame: true,
ResponsiveOrdinalFrame: true,
SparkNetworkFrame: true,
SparkXYFrame: true,
SparkOrdinalFrame: true,
}

const invertKeys = {
Expand Down Expand Up @@ -62,14 +59,8 @@ const buildNewState = (prevState, extentValue, extentType, extentPosition, inver
}
}

function validFrameProps(originalProps, frameType) {
const newProps = {}
const frameProps = framePropHash[frameType]
Object.keys(originalProps).forEach(key => {
if (frameProps[key]) {
newProps[key] = originalProps[key]
}
})
function validFrameProps(originalProps) {
const newProps = { ...originalProps }
return newProps
}

Expand Down Expand Up @@ -280,7 +271,7 @@ class FacetController extends React.Component<Props, State> {
customProps.hoverAnnotation = []
}

return React.cloneElement(child, validFrameProps(customProps, frameType))
return React.cloneElement(child, validFrameProps(customProps))
}

/**
Expand Down

0 comments on commit 9bc9049

Please sign in to comment.