8
8
9
9
'use strict' ;
10
10
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 ;
15
15
16
-
17
- var gridAttrs = exports . attributes = {
16
+ var gridAttrs = {
18
17
rows : {
19
18
valType : 'integer' ,
20
19
min : 1 ,
@@ -168,7 +167,7 @@ var gridAttrs = exports.attributes = {
168
167
169
168
// the shape of the grid - this needs to be done BEFORE supplyDataDefaults
170
169
// so that non-subplot traces can place themselves in the grid
171
- exports . sizeDefaults = function ( layoutIn , layoutOut ) {
170
+ function sizeDefaults ( layoutIn , layoutOut ) {
172
171
var gridIn = layoutIn . grid ;
173
172
if ( ! gridIn ) return ;
174
173
@@ -211,7 +210,7 @@ exports.sizeDefaults = function(layoutIn, layoutOut) {
211
210
x : fillGridPositions ( 'x' , coerce , hasSubplotGrid ? 0.2 : 0.1 , columns ) ,
212
211
y : fillGridPositions ( 'y' , coerce , hasSubplotGrid ? 0.3 : 0.1 , rows , reversed )
213
212
} ;
214
- } ;
213
+ }
215
214
216
215
// coerce x or y sizing attributes and return an array of domains for this direction
217
216
function fillGridPositions ( axLetter , coerce , dfltGap , len , reversed ) {
@@ -232,7 +231,7 @@ function fillGridPositions(axLetter, coerce, dfltGap, len, reversed) {
232
231
233
232
// the (cartesian) contents of the grid - this needs to happen AFTER supplyDataDefaults
234
233
// so that we know what cartesian subplots are available
235
- exports . contentDefaults = function ( layoutIn , layoutOut ) {
234
+ function contentDefaults ( layoutIn , layoutOut ) {
236
235
var gridOut = layoutOut . grid ;
237
236
// make sure we got to the end of handleGridSizing
238
237
if ( ! gridOut || ! gridOut . _domains ) return ;
@@ -368,7 +367,7 @@ exports.contentDefaults = function(layoutIn, layoutOut) {
368
367
}
369
368
}
370
369
}
371
- } ;
370
+ }
372
371
373
372
function fillGridAxes ( axesIn , axesAllowed , len , axisMap , axLetter ) {
374
373
var out = new Array ( len ) ;
@@ -397,3 +396,16 @@ function fillGridAxes(axesIn, axesAllowed, len, axisMap, axLetter) {
397
396
398
397
return out ;
399
398
}
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
+ } ;
0 commit comments