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 ,
@@ -55,7 +54,7 @@ var gridAttrs = exports.attributes = {
5554 valType : 'info_array' ,
5655 freeLength : true ,
5756 dimensions : 2 ,
58- items : { valType : 'enumerated' , values : [ counterRegex ( 'xy' ) . toString ( ) , '' ] } ,
57+ items : { valType : 'enumerated' , values : [ counterRegex ( 'xy' ) . toString ( ) , '' ] , editType : 'plot' } ,
5958 role : 'info' ,
6059 editType : 'plot' ,
6160 description : [
@@ -70,7 +69,7 @@ var gridAttrs = exports.attributes = {
7069 xaxes : {
7170 valType : 'info_array' ,
7271 freeLength : true ,
73- items : { valType : 'enumerated' , values : [ cartesianIdRegex . x . toString ( ) , '' ] } ,
72+ items : { valType : 'enumerated' , values : [ cartesianIdRegex . x . toString ( ) , '' ] , editType : 'plot' } ,
7473 role : 'info' ,
7574 editType : 'plot' ,
7675 description : [
@@ -84,7 +83,7 @@ var gridAttrs = exports.attributes = {
8483 yaxes : {
8584 valType : 'info_array' ,
8685 freeLength : true ,
87- items : { valType : 'enumerated' , values : [ cartesianIdRegex . y . toString ( ) , '' ] } ,
86+ items : { valType : 'enumerated' , values : [ cartesianIdRegex . y . toString ( ) , '' ] , editType : 'plot' } ,
8887 role : 'info' ,
8988 editType : 'plot' ,
9089 description : [
@@ -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
217216function 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
373372function 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+ } ;
0 commit comments