mofron-comp-appbase
Advanced tools
Comparing version 0.4.2 to 0.4.3
122
index.js
@@ -17,2 +17,9 @@ /** | ||
mf.comp.AppBase = class extends mf.Component { | ||
/** | ||
* initialize component | ||
* | ||
* @param p1 (hash object) set option | ||
* @param p1 (string) set app title | ||
* @param p2 (Component Object) child component | ||
*/ | ||
constructor (po, p2) { | ||
@@ -22,3 +29,3 @@ try { | ||
this.name('AppBase'); | ||
this.prmMap('title', 'child'); | ||
this.prmMap(['title', 'child']); | ||
this.prmOpt(po, p2); | ||
@@ -34,3 +41,3 @@ } catch (e) { | ||
* | ||
* @param prm (text, mofron-comp-Text) title | ||
* @note private method | ||
*/ | ||
@@ -44,8 +51,6 @@ initDomConts () { | ||
/* background area */ | ||
this.target().addChild(this.getBgTarget()); | ||
this.addChild(this.bgwrap()); | ||
/* contents */ | ||
let conts = new mf.Component({ | ||
width : '100%' | ||
}); | ||
let conts = new mf.Component({ width : '100%'}); | ||
this.addChild(conts); | ||
@@ -60,14 +65,11 @@ this.target(conts.target()); | ||
/** | ||
* setter/getter app title (header text) | ||
* | ||
* @param p1 (string) app title | ||
* @param p1 (undefined) call as app title | ||
* @return (string) app title | ||
*/ | ||
title (prm) { | ||
try { | ||
if (undefined === prm) { | ||
/* getter */ | ||
return this.header().title(); | ||
} | ||
/* setter */ | ||
this.header().execOption({ | ||
title : prm | ||
}); | ||
} catch (e) { | ||
try { return this.header().title(prm); } catch (e) { | ||
console.error(e.stack); | ||
@@ -78,9 +80,7 @@ throw e; | ||
header () { | ||
try { | ||
if (undefined === this.m_header) { | ||
this.m_header = new Header({}); | ||
} | ||
return this.m_header; | ||
} catch (e) { | ||
/** | ||
* setter/getter app header | ||
*/ | ||
header (prm) { | ||
try { return this.innerComp('header', prm, Header); } catch (e) { | ||
console.error(e.stack); | ||
@@ -91,15 +91,21 @@ throw e; | ||
getBgTarget () { | ||
/** | ||
* setter/getter background wrapper | ||
* | ||
* @param p1 (Component) background wrapper component | ||
* @param p1 (undefined) call ass getter | ||
* @return (Component) background wrapper component | ||
* @note private method | ||
*/ | ||
bgwrap (prm) { | ||
try { | ||
if (undefined === this.m_bgtgt) { | ||
this.m_bgtgt = new mf.Dom({ | ||
tag : 'div', | ||
component : this, | ||
style : { | ||
'position' : 'fixed', | ||
'width' : '100%' | ||
if (true === mf.func.isInclude(prm, 'Component')) { | ||
prm.execOption({ | ||
style : { | ||
'position' : 'relative', | ||
'z-index' : '-10' | ||
} | ||
}); | ||
} | ||
return this.m_bgtgt; | ||
return this.innerComp('bgwrap', prm, mf.Component); | ||
} catch (e) { | ||
@@ -111,2 +117,10 @@ console.error(e.stack); | ||
/** | ||
* setter/getter background component | ||
* height is synchronized with window height by auto | ||
* | ||
* @param p1 (Component) background component | ||
* @param p1 (undefined) call ass getter | ||
* @return (Component) background component | ||
*/ | ||
background (prm) { | ||
@@ -116,32 +130,16 @@ try { | ||
/* getter */ | ||
return (undefined === this.m_backgd) ? null : this.m_backgd; | ||
return this.bgwrap().child(); | ||
} | ||
/* setter */ | ||
if (true !== mf.func.isInclude(prm, 'Component')) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.bgwrap().child(prm); | ||
prm.execOption({ | ||
effect : [ | ||
new Backgd(), | ||
new Synwin(false, true) | ||
new Synwin({ | ||
xflag : false, | ||
yflag : true, | ||
yofs : '-' + this.header().height() | ||
}) | ||
] | ||
}); | ||
this.switchTgt( | ||
this.getBgTarget(), | ||
(abs) => { | ||
try { | ||
if (null === abs.background()) { | ||
abs.child([prm]); | ||
} else { | ||
abs.updChild(abs.background(), prm); | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
}, | ||
this | ||
); | ||
this.m_backgd = prm; | ||
} catch (e) { | ||
@@ -171,6 +169,12 @@ console.error(e.stack); | ||
/** | ||
* setter/getter header color | ||
* | ||
* @param p1 (string) color value (css) | ||
* @param p1 (Array) [red(0-255), green(0-255), blue(0-255)] | ||
* @param p1 (undefined) call as getter | ||
* @return (string) color value (css) | ||
*/ | ||
mainColor (prm) { | ||
try { | ||
return this.header().baseColor(prm); | ||
} catch (e) { | ||
try { return this.header().baseColor(prm); } catch (e) { | ||
console.error(e.stack); | ||
@@ -177,0 +181,0 @@ throw e; |
{ | ||
"name": "mofron-comp-appbase", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "application base component for mofron", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"author": "simparts", | ||
"license": "SEE LICENSE IN LICENSE", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -25,0 +25,0 @@ "url": "https://github.com/simpart/mofron-comp-appbase/issues" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
7552
0
164