Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bee37dd

Browse filesBrowse files
committed
move grid module to components/
... so that its attributes are added to the schema free of circular deps.
1 parent f8e7ee4 commit bee37dd
Copy full SHA for bee37dd

File tree

Expand file treeCollapse file tree

4 files changed

+26
-15
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+26
-15
lines changed

‎src/plots/grid.js renamed to ‎src/components/grid/index.js

Copy file name to clipboardExpand all lines: src/components/grid/index.js
+22-10Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88

99
'use strict';
1010

11-
var Lib = require('../lib');
12-
var domainAttrs = require('./domain').attributes;
13-
var counterRegex = require('../lib/regex').counter;
14-
var cartesianIdRegex = require('./cartesian/constants').idRegex;
11+
var Lib = require('../../lib');
12+
var counterRegex = require('../../lib/regex').counter;
13+
var domainAttrs = require('../../plots/domain').attributes;
14+
var cartesianIdRegex = require('../../plots/cartesian/constants').idRegex;
1515

16-
17-
var gridAttrs = exports.attributes = {
16+
var gridAttrs = {
1817
rows: {
1918
valType: 'integer',
2019
min: 1,
@@ -168,7 +167,7 @@ var gridAttrs = exports.attributes = {
168167

169168
// the shape of the grid - this needs to be done BEFORE supplyDataDefaults
170169
// so that non-subplot traces can place themselves in the grid
171-
exports.sizeDefaults = function(layoutIn, layoutOut) {
170+
function sizeDefaults(layoutIn, layoutOut) {
172171
var gridIn = layoutIn.grid;
173172
if(!gridIn) return;
174173

@@ -211,7 +210,7 @@ exports.sizeDefaults = function(layoutIn, layoutOut) {
211210
x: fillGridPositions('x', coerce, hasSubplotGrid ? 0.2 : 0.1, columns),
212211
y: fillGridPositions('y', coerce, hasSubplotGrid ? 0.3 : 0.1, rows, reversed)
213212
};
214-
};
213+
}
215214

216215
// coerce x or y sizing attributes and return an array of domains for this direction
217216
function fillGridPositions(axLetter, coerce, dfltGap, len, reversed) {
@@ -232,7 +231,7 @@ function fillGridPositions(axLetter, coerce, dfltGap, len, reversed) {
232231

233232
// the (cartesian) contents of the grid - this needs to happen AFTER supplyDataDefaults
234233
// so that we know what cartesian subplots are available
235-
exports.contentDefaults = function(layoutIn, layoutOut) {
234+
function contentDefaults(layoutIn, layoutOut) {
236235
var gridOut = layoutOut.grid;
237236
// make sure we got to the end of handleGridSizing
238237
if(!gridOut || !gridOut._domains) return;
@@ -368,7 +367,7 @@ exports.contentDefaults = function(layoutIn, layoutOut) {
368367
}
369368
}
370369
}
371-
};
370+
}
372371

373372
function fillGridAxes(axesIn, axesAllowed, len, axisMap, axLetter) {
374373
var out = new Array(len);
@@ -397,3 +396,16 @@ function fillGridAxes(axesIn, axesAllowed, len, axisMap, axLetter) {
397396

398397
return out;
399398
}
399+
400+
module.exports = {
401+
moduleType: 'component',
402+
name: 'grid',
403+
404+
schema: {
405+
layout: {grid: gridAttrs}
406+
},
407+
408+
layoutAttributes: gridAttrs,
409+
sizeDefaults: sizeDefaults,
410+
contentDefaults: contentDefaults
411+
};

‎src/core.js

Copy file name to clipboardExpand all lines: src/core.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ exports.register([
6363
require('./components/updatemenus'),
6464
require('./components/sliders'),
6565
require('./components/rangeslider'),
66-
require('./components/rangeselector')
66+
require('./components/rangeselector'),
67+
require('./components/grid'),
6768
]);
6869

6970
// locales en and en-US are required for default behavior

‎src/plots/layout_attributes.js

Copy file name to clipboardExpand all lines: src/plots/layout_attributes.js
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
var fontAttrs = require('./font_attributes');
1212
var colorAttrs = require('../components/color/attributes');
13-
var gridAttrs = require('./grid').attributes;
1413

1514
var globalFont = fontAttrs({
1615
editType: 'calc',
@@ -196,6 +195,5 @@ module.exports = {
196195
'being treated as immutable, thus any data array with a',
197196
'different identity from its predecessor contains new data.'
198197
].join(' ')
199-
},
200-
grid: gridAttrs
198+
}
201199
};

‎src/plots/plots.js

Copy file name to clipboardExpand all lines: src/plots/plots.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ var axisIDs = require('../plots/cartesian/axis_ids');
1919
var Lib = require('../lib');
2020
var _ = Lib._;
2121
var Color = require('../components/color');
22+
var Grid = require('../components/grid');
2223
var BADNUM = require('../constants/numerical').BADNUM;
23-
var Grid = require('./grid');
2424

2525
var plots = module.exports = {};
2626

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.