Skip to content

Commit cf5c799

Browse files
committed
Name changes & add isRequired
1 parent 9179b24 commit cf5c799

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

src/EditorControls.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class EditorControls extends Component {
2828
return {
2929
advancedTraceTypeSelector: this.props.advancedTraceTypeSelector,
3030
config: gd._context,
31-
customSrcHandling: this.props.customSrcHandling,
31+
srcConverters: this.props.srcConverters,
3232
data: gd.data,
3333
dataSources: this.props.dataSources,
3434
dataSourceOptions: this.props.dataSourceOptions,
@@ -281,9 +281,9 @@ EditorControls.propTypes = {
281281
beforeUpdateTraces: PropTypes.func,
282282
children: PropTypes.node,
283283
className: PropTypes.string,
284-
customSrcHandling: PropTypes.shape({
285-
toSrc: PropTypes.func,
286-
fromSrc: PropTypes.func,
284+
srcConverters: PropTypes.shape({
285+
toSrc: PropTypes.func.isRequired,
286+
fromSrc: PropTypes.func.isRequired,
287287
}),
288288
dataSourceOptionRenderer: PropTypes.func,
289289
dataSourceOptions: PropTypes.array,
@@ -311,9 +311,9 @@ EditorControls.defaultProps = {
311311
EditorControls.childContextTypes = {
312312
advancedTraceTypeSelector: PropTypes.bool,
313313
config: PropTypes.object,
314-
customSrcHandling: PropTypes.shape({
315-
toSrc: PropTypes.func,
316-
fromSrc: PropTypes.func,
314+
srcConverters: PropTypes.shape({
315+
toSrc: PropTypes.func.isRequired,
316+
fromSrc: PropTypes.func.isRequired,
317317
}),
318318
data: PropTypes.array,
319319
dataSourceOptionRenderer: PropTypes.func,

src/PlotlyEditor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PlotlyEditor extends Component {
2525
traceTypesConfig={this.props.traceTypesConfig}
2626
dictionaries={this.props.dictionaries}
2727
showFieldTooltips={this.props.showFieldTooltips}
28-
customSrcHandling={this.props.customSrcHandling}
28+
srcConverters={this.props.srcConverters}
2929
>
3030
{this.props.children}
3131
</EditorControls>
@@ -71,9 +71,9 @@ PlotlyEditor.propTypes = {
7171
divId: PropTypes.string,
7272
hideControls: PropTypes.bool,
7373
showFieldTooltips: PropTypes.bool,
74-
customSrcHandling: PropTypes.shape({
75-
toSrc: PropTypes.func,
76-
fromSrc: PropTypes.func,
74+
srcConverters: PropTypes.shape({
75+
toSrc: PropTypes.func.isRequired,
76+
fromSrc: PropTypes.func.isRequired,
7777
}),
7878
};
7979

src/components/fields/DataSelector.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ export class UnconnectedDataSelector extends Component {
2727

2828
this.srcAttr = props.attr + 'src';
2929
this.srcProperty = nestedProperty(props.container, this.srcAttr).get();
30-
this.fullValue = this.context.customSrcHandling
31-
? this.context.customSrcHandling.toSrc(
32-
this.srcProperty,
33-
props.container.type
34-
)
30+
this.fullValue = this.context.srcConverters
31+
? this.context.srcConverters.toSrc(this.srcProperty, props.container.type)
3532
: this.srcProperty;
3633

3734
this.is2D = false;
@@ -77,8 +74,8 @@ export class UnconnectedDataSelector extends Component {
7774
this.srcAttr,
7875
this.props.container.type,
7976
{
80-
fromSrc: this.context.customSrcHandling
81-
? this.context.customSrcHandling.fromSrc
77+
fromSrc: this.context.srcConverters
78+
? this.context.srcConverters.fromSrc
8279
: null,
8380
}
8481
);
@@ -127,9 +124,9 @@ UnconnectedDataSelector.contextTypes = {
127124
dataSourceOptions: PropTypes.array,
128125
dataSourceValueRenderer: PropTypes.func,
129126
dataSourceOptionRenderer: PropTypes.func,
130-
customSrcHandling: PropTypes.shape({
131-
toSrc: PropTypes.func,
132-
fromSrc: PropTypes.func,
127+
srcConverters: PropTypes.shape({
128+
toSrc: PropTypes.func.isRequired,
129+
fromSrc: PropTypes.func.isRequired,
133130
}),
134131
};
135132

0 commit comments

Comments
 (0)