8000 Add registry of component modules by etpinard · Pull Request #845 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Add registry of component modules #845

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

Merged
merged 18 commits into from
Aug 19, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint plot_schema.js
  • Loading branch information
etpinard committed Aug 11, 2016
commit d11c8f912833887b0a34d93515fbc27deb56e433
14 changes: 8 additions & 6 deletions src/plot_api/plot_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ var Registry = require('../registry');
var Plots = require('../plots/plots');
var Lib = require('../lib');

// FIXME polar attribute are not part of Plotly yet
var polarAreaAttrs = require('../plots/polar/area_attributes');
var polarAxisAttrs = require('../plots/polar/axis_attributes');

var extendFlat = Lib.extendFlat;
var extendDeep = Lib.extendDeep;
var extendDeepAll = Lib.extendDeepAll;
Expand All @@ -34,9 +38,6 @@ var plotSchema = {
defs: {}
};

// FIXME polar attribute are not part of Plotly yet
var polarAreaAttrs = require('../plots/polar/area_attributes'),
polarAxisAttrs = require('../plots/polar/axis_attributes');

var PlotSchema = module.exports = {};

Expand Down Expand Up @@ -169,7 +170,7 @@ function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) {

if(k === NESTED_MODULE) {
Object.keys(attrsIn[k]).forEach(function(kk) {
nestedModule = getModule({module: attrsIn[k][kk]});
nestedModule = getModule({_module: attrsIn[k][kk]});
if(nestedModule === undefined) return;

nestedAttrs = nestedModule[whichAttrs];
Expand All @@ -187,7 +188,7 @@ function coupleAttrs(attrsIn, attrsOut, whichAttrs, type) {
Object.keys(attrsIn[k]).forEach(function(kk) {
if(kk !== type) return;

composedModule = getModule({module: attrsIn[k][kk]});
composedModule = getModule({_module: attrsIn[k][kk]});
if(composedModule === undefined) return;

composedAttrs = composedModule[whichAttrs];
Expand Down Expand Up @@ -253,7 +254,8 @@ function getModule(arg) {
}

var subplotsRegistry = Registry.subplotsRegistry,
_module = arg.module;
componentsRegistry = Registry.componentsRegistry,
_module = arg._module;

if(subplotsRegistry[_module]) return subplotsRegistry[_module];
else if('module' in arg) return Plotly[_module];
Expand Down
0