mofron-comp-header
Advanced tools
Comparing version 0.5.2 to 0.6.0
108
index.js
@@ -12,18 +12,2 @@ /** | ||
mofron.comp.Header = class extends mofron.Component { | ||
/** | ||
* initialize component | ||
* | ||
* @param prm (object) Component | ||
*/ | ||
constructor (prm_opt) { | ||
try { | ||
super(); | ||
this.name("Header"); | ||
this.prmOpt(prm_opt); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
@@ -33,19 +17,23 @@ initDomConts (prm) { | ||
/* set header dom contents */ | ||
var hdr = new mofron.Dom('div',this); | ||
hdr.style('width' , '100%'); | ||
hdr.style('border-bottom', 'solid 1px lightgray'); | ||
hdr.style('float' , 'left'); | ||
var hdr = new mofron.Dom({ | ||
tag : 'div', | ||
component : this, | ||
style : { | ||
'width' : '100%', | ||
'border-bottom' : 'solid 1px lightgray', | ||
// 'float' : 'left' | ||
} | ||
}); | ||
var pad = new mofron.Dom({ | ||
tag : 'div', | ||
component : this, | ||
style : { | ||
// 'float' : 'none', | ||
'position' : 'static' | ||
} | ||
}); | ||
var pad = new mofron.Dom('div',this); | ||
pad.style('float' , 'none'); | ||
pad.style('position', 'static'); | ||
/* set dom contents */ | ||
this.vdom().child([ | ||
hdr, | ||
pad | ||
]); | ||
this.vdom().child([hdr, pad]); | ||
this.target(hdr); | ||
this.styleTgt(this.vdom()); | ||
@@ -56,3 +44,2 @@ /* set default height */ | ||
/* child comp is added at horizon layout */ | ||
@@ -66,7 +53,14 @@ this.addLayout(new mofron.layout.Horizon()); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
themeConts () { | ||
try { | ||
/* set theme color */ | ||
var clr = this.theme().getColor(0); | ||
if (null != clr) { | ||
this.color(clr); | ||
} | ||
this.color( | ||
(null === this.theme().getColor(0)) ? undefined : this.theme().getColor(0) | ||
); | ||
} catch (e) { | ||
@@ -81,3 +75,3 @@ console.error(e.stack); | ||
* | ||
* @param hei : (int) height (px) | ||
* @param hei : (int,string) height | ||
*/ | ||
@@ -87,9 +81,11 @@ height (val) { | ||
if (undefined === val) { | ||
return this.style('height'); | ||
/* getter */ | ||
return mofron.func.getLength(this.style('height')); | ||
} | ||
if (('number' !== typeof val) || (0 > val)) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.style('height', val + 'px'); | ||
/* setter */ | ||
var set_hei = { | ||
'height' : ('number' === typeof val) ? (val + 'px') : val | ||
}; | ||
this.style(set_hei); | ||
this.vdom().child()[1].style(set_hei); | ||
} catch (e) { | ||
@@ -102,3 +98,3 @@ console.error(e.stack); | ||
/** | ||
* set header background color | ||
* header background color setter / getter | ||
* | ||
@@ -110,11 +106,10 @@ * clr : (object) color | ||
if (undefined === clr) { | ||
return mofron.func.getColor( | ||
this.style('background') | ||
); | ||
/* getter */ | ||
return mofron.func.getColor(this.style('background')); | ||
} | ||
if ((null === clr) || ('object' !== (typeof clr))) { | ||
/* setter */ | ||
if (false === mofron.func.isObject(clr, 'Color')) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.style('background', clr.getStyle()); | ||
this.style({ 'background' : clr.getStyle() }); | ||
} catch (e) { | ||
@@ -130,7 +125,3 @@ console.error(e.stack); | ||
/* getter */ | ||
if ('fixed' === this.style('position')) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
return ('fixed' === this.style('position')) ? true : false; | ||
} | ||
@@ -141,7 +132,6 @@ /* setter */ | ||
} | ||
if (true === flg) { | ||
this.style('position', 'fixed', true); | ||
} else { | ||
this.style('position', null, true); | ||
} | ||
this.style( | ||
{ 'position' : (true === flg) ? 'fixed' : null }, | ||
true | ||
); | ||
} catch (e) { | ||
@@ -148,0 +138,0 @@ console.error(e.stack); |
{ | ||
"name": "mofron-comp-header", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "header component for mofron", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
5933
123