mofron-comp-accordion
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -111,6 +111,9 @@ require('mofron-comp-heading'); | ||
}, { | ||
key: 'setChangeEvt', | ||
value: function setChangeEvt(fnc) { | ||
key: 'changeEvent', | ||
value: function changeEvent(fnc) { | ||
try { | ||
if (null === fnc) { | ||
if (undefined === fnc) { | ||
return this.chg_evt; | ||
} | ||
if ('function' !== typeof fnc) { | ||
throw new Error('invalid parameter'); | ||
@@ -144,3 +147,10 @@ } | ||
var idx = clk_prm[2]; | ||
/* switch display contents */ | ||
conts.visible(!acd_obj.state(idx)); | ||
var evt = acd_obj.changeEvent(); | ||
if (null !== evt) { | ||
evt(acd_obj, idx); | ||
} | ||
} catch (e) { | ||
@@ -165,3 +175,5 @@ console.error(e.stack); | ||
value: function remove(idx) { | ||
try {} catch (e) { | ||
try { | ||
this.getChild(idx).visible(false); | ||
} catch (e) { | ||
console.error(e.stack); | ||
@@ -168,0 +180,0 @@ throw e; |
{ | ||
"name": "mofron-comp-accordion", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Accordion Component for mofron", | ||
@@ -5,0 +5,0 @@ "main": "dist/accordion.js", |
# mofron-comp-accordion | ||
accordion component for mofron | ||
Accordion WebUI Component for mofron | ||
# Install | ||
```bash | ||
npm install --save-dev mofron | ||
``` | ||
# Quick Start | ||
require webpack | ||
```html | ||
<html> | ||
<head></head> | ||
<body style="margin:0px;padding:0px;"></body> | ||
<script src='./path/to/webpack/output.js'></script> | ||
</html> | ||
``` | ||
example | ||
```javascript | ||
require("mofron"); | ||
require("mofron-comp-accordion"); | ||
var acd = new mofron.comp.Accordion(); | ||
acd.add('Header 1', new mofron.comp.Text('Test Contents 1')); | ||
acd.add('Header 2', new mofron.comp.Text('Test Contents 2')); | ||
acd.add('Header 3', new mofron.comp.Text('Test Contents 3')); | ||
acd.visible(true); | ||
``` | ||
#class specification | ||
| Method | Parameter | Description | | ||
|:------------------|:-----------------------------------------------------------------|:-------------------------------| | ||
| add | string : header title<br> | button color getter/setter. <br>(for getter, do not specify parameters) | | ||
| changeEvent | function : function for click event listener<br>mixed : function parameter (option) |set button click event | | ||
| add | object : color | button color getter/setter. <br>(for getter, do not specify parameters) | | ||
@@ -42,5 +42,8 @@ /** | ||
setChangeEvt (fnc) { | ||
changeEvent (fnc) { | ||
try { | ||
if (null === fnc) { | ||
if (undefined === fnc) { | ||
return this.chg_evt; | ||
} | ||
if ('function' !== (typeof fnc)) { | ||
throw new Error('invalid parameter'); | ||
@@ -55,3 +58,3 @@ } | ||
add (ttl,cnt) { | ||
add (ttl, cnt) { | ||
try { | ||
@@ -76,3 +79,10 @@ if ( (undefined === cnt) || | ||
var idx = clk_prm[2]; | ||
/* switch display contents */ | ||
conts.visible(!(acd_obj.state(idx))); | ||
var evt = acd_obj.changeEvent(); | ||
if (null !== evt) { | ||
evt(acd_obj,idx); | ||
} | ||
} catch (e) { | ||
@@ -97,3 +107,3 @@ console.error(e.stack); | ||
try { | ||
this.getChild(idx).visible(false); | ||
} catch (e) { | ||
@@ -100,0 +110,0 @@ console.error(e.stack); |
14712
316
43