mofron-layout-margin
Advanced tools
Comparing version 0.2.2 to 0.2.3
59
index.js
@@ -9,2 +9,9 @@ /** | ||
mf.layout.Margin = class extends mf.Layout { | ||
/** | ||
* initialize margin layout | ||
* | ||
* @param p1 (object) layout option | ||
* @param p1 (string) margin type | ||
* @param p2 (string) margin size value | ||
*/ | ||
constructor (po, p2) { | ||
@@ -14,3 +21,3 @@ try { | ||
this.name('Margin'); | ||
this.prmMap('type', 'value'); | ||
this.prmMap(['type', 'value']); | ||
this.prmOpt(po, p2); | ||
@@ -23,2 +30,7 @@ } catch (e) { | ||
/** | ||
* margin layout | ||
* | ||
* @note private method | ||
*/ | ||
contents (idx, tgt) { | ||
@@ -28,3 +40,3 @@ try { | ||
let setmgn = {}; | ||
setmgn[mg] = this.value().toString(); | ||
setmgn[mg] = this.value(); | ||
tgt.adom().style(setmgn); | ||
@@ -37,16 +49,16 @@ } catch (e) { | ||
/** | ||
* setter/getter margin type | ||
* | ||
* @param p1 (string) margin type ('top', 'right', 'bottom', 'left') | ||
* @param p1 (undefined) call as getter | ||
* @return (string) margin type | ||
*/ | ||
type (prm) { | ||
try { | ||
if (undefined === prm) { | ||
/* getter */ | ||
return (undefined === this.m_type) ? null : this.m_type; | ||
} | ||
/* setter */ | ||
if ( ('top' !== prm) && | ||
('right' !== prm) && | ||
('bottom' !== prm) && | ||
('left' !== prm) ) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_type = prm; | ||
return this.member( | ||
'type', | ||
['top', 'right', 'bottom', 'left'], | ||
prm | ||
); | ||
} catch (e) { | ||
@@ -58,10 +70,17 @@ console.error(e.stack); | ||
/** | ||
* setter/getter margin size value | ||
* | ||
* @param (string) margin size (css value) | ||
* @param (undefined) call as getter | ||
* @return (string) margin size (css value) | ||
*/ | ||
value (prm) { | ||
try { | ||
if (undefined === prm) { | ||
/* getter */ | ||
return (undefined === this.m_value) ? null : this.m_value; | ||
} | ||
/* setter */ | ||
this.m_value = mf.func.getSizeObj(prm); | ||
return this.member( | ||
'value', | ||
'string', | ||
(undefined !== prm) ? mf.func.getSize(prm).toString() : prm, | ||
'0.25rem' | ||
); | ||
} catch (e) { | ||
@@ -68,0 +87,0 @@ console.error(e.stack); |
{ | ||
"name": "mofron-layout-margin", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "margin layout of mofron", | ||
@@ -14,3 +14,3 @@ "main": "index.js", | ||
"keywords": [ | ||
"mofron" | ||
"front-end" | ||
], | ||
@@ -17,0 +17,0 @@ "author": "simpart", |
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
4259
83