@@ -5,6 +5,7 @@ import * as CSSModules from 'react-css-modules';
55import { connect } from 'react-redux' ;
66import { Channel } from 'vega-lite/build/src/channel' ;
77import { FieldOneOfPredicate , FieldRangePredicate } from 'vega-lite/build/src/predicate' ;
8+ import { TopLevelFacetedUnitSpec } from 'vega-lite/build/src/spec' ;
89import { FilterAction } from '../../actions' ;
910import { ActionHandler } from '../../actions/index' ;
1011import { createDispatchHandler } from '../../actions/redux-action' ;
@@ -13,7 +14,7 @@ import {ShelfAction, SPEC_CLEAR} from '../../actions/shelf';
1314import { ShelfUnitSpec , State } from '../../models' ;
1415import { VoyagerConfig } from '../../models/config' ;
1516import { isShelfFieldDef , isShelfValueDef , ShelfFieldDef } from '../../models/shelf' ;
16- import { selectConfig , selectDataset , selectShelfPreview } from '../../selectors' ;
17+ import { selectConfig , selectDataset , selectMainSpec , selectShelfPreview } from '../../selectors' ;
1718import { selectSchemaFieldDefs } from '../../selectors/index' ;
1819import { selectFilters , selectShelfSpec } from '../../selectors/shelf' ;
1920import { FilterPane } from '../filter-pane' ;
@@ -34,6 +35,8 @@ interface EncodingPanelProps extends ActionHandler<ShelfAction | ResultAsyncActi
3435 fieldDefs : ShelfFieldDef [ ] ;
3536
3637 config : VoyagerConfig ;
38+
39+ mainSpec : TopLevelFacetedUnitSpec ;
3740}
3841
3942class EncodingPanelBase extends React . PureComponent < EncodingPanelProps , { } > {
@@ -108,7 +111,7 @@ class EncodingPanelBase extends React.PureComponent<EncodingPanelProps, {}> {
108111 private encodingShelf ( channel : Channel ) {
109112 // This one can't be wildcard, thus we use VL's Channel, not our ShelfChannel
110113
111- const { handleAction, spec, specPreview, schema} = this . props ;
114+ const { handleAction, mainSpec , spec, specPreview, schema} = this . props ;
112115 const { encoding} = specPreview || spec ;
113116 const { mark} = specPreview || spec ;
114117 const encodingChannel = encoding [ channel ] ;
@@ -121,6 +124,7 @@ class EncodingPanelBase extends React.PureComponent<EncodingPanelProps, {}> {
121124 handleAction = { handleAction }
122125 valueDef = { isShelfValueDef ( encodingChannel ) ? encodingChannel : undefined }
123126 mark = { mark }
127+ mainSpec = { mainSpec }
124128 />
125129 ) ;
126130 }
@@ -135,7 +139,7 @@ class EncodingPanelBase extends React.PureComponent<EncodingPanelProps, {}> {
135139 }
136140
137141 private wildcardShelf ( index : number ) {
138- const { handleAction, spec, specPreview, schema} = this . props ;
142+ const { handleAction, spec, specPreview, schema, mainSpec } = this . props ;
139143 const { anyEncodings} = specPreview || spec ;
140144 const { mark} = specPreview || spec ;
141145 const id = {
@@ -152,6 +156,7 @@ class EncodingPanelBase extends React.PureComponent<EncodingPanelProps, {}> {
152156 handleAction = { handleAction }
153157 valueDef = { undefined } // don't support constant value for wildcard shelf
154158 mark = { mark }
159+ mainSpec = { mainSpec }
155160 />
156161 ) ;
157162 }
@@ -181,7 +186,8 @@ export const EncodingPane = connect(
181186 schema : selectDataset ( state ) . schema ,
182187 fieldDefs : selectSchemaFieldDefs ( state ) ,
183188 specPreview : selectShelfPreview ( state ) . spec ,
184- config : selectConfig ( state )
189+ config : selectConfig ( state ) ,
190+ mainSpec : selectMainSpec ( state )
185191 } ;
186192 } ,
187193 createDispatchHandler < ShelfAction > ( )
0 commit comments