mofron-comp-accordion
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -0,1 +1,3 @@ | ||
require('mofron-comp-heading'); | ||
require('mofron-event-click'); | ||
/******/ (function(modules) { // webpackBootstrap | ||
@@ -47,4 +49,8 @@ /******/ // The module cache | ||
"use strict"; | ||
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -58,17 +64,140 @@ | ||
* @file accordion.js | ||
* @author simpart | ||
*/ | ||
mofron.comp.Accordion = function (_mofron$comp$Base) { | ||
_inherits(_class, _mofron$comp$Base); | ||
/** | ||
* @class mofron.comp.Accordion | ||
* @brief Accordion Component class | ||
*/ | ||
mofron.comp.Accordion = function (_mofron$Component) { | ||
_inherits(_class, _mofron$Component); | ||
function _class() { | ||
_classCallCheck(this, _class); | ||
function _class(prm, opt) { | ||
_classCallCheck(this, _class); | ||
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments)); | ||
} | ||
try { | ||
var _this = _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, prm)); | ||
return _class; | ||
}(mofron.comp.Base); | ||
_this.setBaseName('Accordion'); | ||
_this.name('Accordion'); | ||
_this.chg_evt = null; | ||
if (null !== opt) { | ||
_this.option(opt); | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
return _this; | ||
} | ||
/** | ||
* initialize DOM contents | ||
* | ||
* @param vd : (mofron.util.Vdom) vdom object | ||
*/ | ||
_createClass(_class, [{ | ||
key: 'initDomConts', | ||
value: function initDomConts(prm) { | ||
try { | ||
this.target(this.vdom()); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
}, { | ||
key: 'setChangeEvt', | ||
value: function setChangeEvt(fnc) { | ||
try { | ||
if (null === fnc) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.chg_evt = fnc; | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
}, { | ||
key: 'add', | ||
value: function add(ttl, cnt) { | ||
try { | ||
if (undefined === cnt || null === cnt || 'object' !== (typeof cnt === 'undefined' ? 'undefined' : _typeof(cnt))) { | ||
throw new Error('invalid parameter'); | ||
} | ||
var hdg_thm = this.theme().getComp('Heading'); | ||
if (null === hdg_thm) { | ||
hdg_thm = mofron.comp.Heading; | ||
} | ||
var hdg = new hdg_thm(ttl, { | ||
level: 2 | ||
}); | ||
hdg.addEvent(new mofron.event.Click(function (clk_prm) { | ||
try { | ||
var acd_obj = clk_prm[0]; | ||
var conts = clk_prm[1]; | ||
var idx = clk_prm[2]; | ||
conts.visible(!acd_obj.state(idx)); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
}, [this, cnt, this.getChild().length])); | ||
var wrp = new mofron.Component(); | ||
wrp.addChild(hdg); | ||
wrp.addChild(cnt, false); | ||
this.addChild(wrp); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
}, { | ||
key: 'remove', | ||
value: function remove(idx) { | ||
try {} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
}, { | ||
key: 'state', | ||
value: function state(idx) { | ||
try { | ||
if ('number' !== typeof idx) { | ||
throw new Error('invalid parameter'); | ||
} | ||
var chdlen = this.getChild(); | ||
if (chdlen.length <= idx || 0 > idx) { | ||
throw new Error('invalid parameter'); | ||
} | ||
if (false === chdlen[idx].isRendered()) { | ||
return false; | ||
} | ||
var disp = chdlen[idx].getChild(1).vdom().style('display'); | ||
if ('none' === disp) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
}]); | ||
return _class; | ||
}(mofron.Component); | ||
/***/ } | ||
/******/ ]); | ||
/******/ ]); |
{ | ||
"name": "mofron-comp-accordion", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Accordion Component for mofron", | ||
@@ -5,0 +5,0 @@ "main": "dist/accordion.js", |
/** | ||
* @file accordion.js | ||
* @author simpart | ||
*/ | ||
mofron.comp.Accordion = class extends mofron.comp.Base { | ||
/** | ||
* @class mofron.comp.Accordion | ||
* @brief Accordion Component class | ||
*/ | ||
mofron.comp.Accordion = class extends mofron.Component { | ||
constructor (prm,opt) { | ||
try { | ||
super(prm); | ||
this.setBaseName('Accordion'); | ||
this.name('Accordion'); | ||
this.chg_evt = null; | ||
if (null !== opt) { | ||
this.option(opt); | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
/** | ||
* initialize DOM contents | ||
* | ||
* @param vd : (mofron.util.Vdom) vdom object | ||
*/ | ||
initDomConts (prm) { | ||
try { | ||
this.target(this.vdom()); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
setChangeEvt (fnc) { | ||
try { | ||
if (null === fnc) { | ||
throw new Error('invalid parameter'); | ||
} | ||
this.chg_evt = fnc; | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
add (ttl,cnt) { | ||
try { | ||
if ( (undefined === cnt) || | ||
(null === cnt) || | ||
('object' !== (typeof cnt)) ) { | ||
throw new Error('invalid parameter'); | ||
} | ||
var hdg_thm = this.theme().getComp('Heading'); | ||
if (null === hdg_thm) { | ||
hdg_thm = mofron.comp.Heading; | ||
} | ||
var hdg = new hdg_thm(ttl,{ | ||
level : 2 | ||
}); | ||
hdg.addEvent(new mofron.event.Click(function(clk_prm) { | ||
try { | ||
var acd_obj = clk_prm[0]; | ||
var conts = clk_prm[1]; | ||
var idx = clk_prm[2]; | ||
conts.visible(!(acd_obj.state(idx))); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
},[this,cnt,this.getChild().length])); | ||
var wrp = new mofron.Component(); | ||
wrp.addChild(hdg); | ||
wrp.addChild(cnt, false); | ||
this.addChild(wrp); | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
remove (idx) { | ||
try { | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
state (idx) { | ||
try { | ||
if ('number' !== typeof idx) { | ||
throw new Error('invalid parameter'); | ||
} | ||
var chdlen = this.getChild(); | ||
if ((chdlen.length <= idx) || (0 > idx)) { | ||
throw new Error('invalid parameter'); | ||
} | ||
if (false === chdlen[idx].isRendered()) { | ||
return false; | ||
} | ||
var disp = chdlen[idx].getChild(1).vdom().style('display'); | ||
if ('none' === disp) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} catch (e) { | ||
console.error(e.stack); | ||
throw e; | ||
} | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12715
299
1