mofron-layout-margin
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -63,6 +63,6 @@ /******/ (function(modules) { // webpackBootstrap | ||
mofron.layout.Margin = function (_mofron$layout$Base) { | ||
_inherits(_class, _mofron$layout$Base); | ||
mofron.layout.Margin = function (_mofron$Layout) { | ||
_inherits(_class, _mofron$Layout); | ||
function _class(tp, v) { | ||
function _class(tp, val) { | ||
_classCallCheck(this, _class); | ||
@@ -73,7 +73,17 @@ | ||
if ('string' != typeof tp || '' != tp && 'top' != tp && 'right' != tp && 'bottom' != tp && 'left' != tp || 'number' != typeof v) { | ||
throw new Error('invalid parameter'); | ||
var _tp = undefined === tp ? null : tp; | ||
var _val = undefined === val ? null : val; | ||
if (null === _tp) { | ||
throw new Error('invalid paramter'); | ||
} else if ('number' === typeof _tp) { | ||
_val = _tp; | ||
_tp = ''; | ||
} | ||
_this.type = tp; | ||
_this.val = v; | ||
_this.m_type = null; | ||
_this.m_value = null; | ||
_this.type(_tp); | ||
_this.value(_val); | ||
} catch (e) { | ||
@@ -91,6 +101,6 @@ console.error(e.stack); | ||
var mg = 'margin'; | ||
if ('' !== this.type) { | ||
mg += '-' + this.type; | ||
if ('' !== this.type()) { | ||
mg += '-' + this.type(); | ||
} | ||
tgt.vdom().style(mg, this.val + 'px'); | ||
tgt.vdom().style(mg, this.value() + 'px'); | ||
} catch (e) { | ||
@@ -102,10 +112,29 @@ console.error(e.stack); | ||
}, { | ||
key: 'type', | ||
value: function type(tp) { | ||
try { | ||
if (undefined === tp) { | ||
return this.m_type; | ||
} | ||
if ('string' != typeof tp || '' != tp && 'top' != tp && 'right' != tp && 'bottom' != tp && 'left' != tp) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_type = tp; | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
}, { | ||
key: 'value', | ||
value: function value(val) { | ||
try { | ||
var _val = val === undefined ? null : val; | ||
if (null === _val) { | ||
return this.val; | ||
if (undefined === val) { | ||
return this.m_value; | ||
} | ||
this.val = _val; | ||
if (null === val || 'number' !== typeof val) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_value = val; | ||
} catch (e) { | ||
@@ -119,5 +148,5 @@ console.error(e.stack); | ||
return _class; | ||
}(mofron.layout.Base); | ||
}(mofron.Layout); | ||
/***/ } | ||
/******/ ]); |
{ | ||
"name": "mofron-layout-margin", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "margin layout of mofron", | ||
@@ -5,0 +5,0 @@ "main": "dist/margin.js", |
@@ -7,17 +7,22 @@ /** | ||
mofron.layout.Margin = class extends mofron.layout.Base { | ||
constructor (tp,v) { | ||
mofron.layout.Margin = class extends mofron.Layout { | ||
constructor (tp,val) { | ||
try { | ||
super(); | ||
if ( ('string' != (typeof tp)) || | ||
( ('' != tp) && | ||
('top' != tp) && | ||
('right' != tp) && | ||
('bottom' != tp) && | ||
('left' != tp) ) || | ||
('number' != (typeof v)) ) { | ||
throw new Error('invalid parameter'); | ||
var _tp = (undefined === tp) ? null : tp; | ||
var _val = (undefined === val) ? null : val; | ||
if (null === _tp) { | ||
throw new Error('invalid paramter'); | ||
} else if ('number' === (typeof _tp)) { | ||
_val = _tp; | ||
_tp = ''; | ||
} | ||
this.type = tp; | ||
this.val = v; | ||
this.m_type = null; | ||
this.m_value = null; | ||
this.type(_tp); | ||
this.value(_val); | ||
} catch (e) { | ||
@@ -32,6 +37,6 @@ console.error(e.stack); | ||
var mg = 'margin'; | ||
if ('' !== this.type) { | ||
mg += '-' + this.type; | ||
if ('' !== this.type()) { | ||
mg += '-' + this.type(); | ||
} | ||
tgt.vdom().style(mg, this.val + 'px'); | ||
tgt.vdom().style(mg, this.value() + 'px'); | ||
} catch (e) { | ||
@@ -43,9 +48,32 @@ console.error(e.stack); | ||
type (tp) { | ||
try { | ||
if (undefined === tp) { | ||
return this.m_type; | ||
} | ||
if ( ('string' != (typeof tp)) || | ||
( ('' != tp) && | ||
('top' != tp) && | ||
('right' != tp) && | ||
('bottom' != tp) && | ||
('left' != tp) ) ) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_type = tp; | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
value (val) { | ||
try { | ||
var _val = (val === undefined) ? null : val; | ||
if (null === _val) { | ||
return this.val; | ||
if (undefined === val) { | ||
return this.m_value; | ||
} | ||
this.val = _val; | ||
if ((null === val) || ('number' !== (typeof val))) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.m_value = val; | ||
} catch (e) { | ||
@@ -52,0 +80,0 @@ console.error(e.stack); |
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
9674
209