-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
107 lines (102 loc) · 2.92 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* @file mofron-event-focusbdr/index.js
* @author simpart
*/
const mf = require('mofron');
const Focus = require('mofron-event-focus');
/**
* @class mofron.event.FocusBdr
* @brief focus border event class for component
*/
mf.event.FocusBdr = class extends Focus {
constructor (po, p2) {
try {
super();
this.name('focusbdr');
this.m_border = {
'border-color' : 'black',
'border-width' : '1px',
'border-style' : 'solid'
};
this.prmOpt(po, p2);
} catch (e) {
console.error(e.stack);
throw e;
}
}
contents (tgt_dom) {
try {
super.contents(tgt_dom);
if (null === this.handler()[0]) {
super.handler(this.border());
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
border (clr, wid) {
try {
if ((undefined === clr) && (undefined === wid)) {
/* getter */
return (flg,cmp) => {
try {
if (true === flg) {
cmp.execOption({
style : this.m_border
});
} else {
let set_style = {};
for (let bidx in this.m_border) {
set_style[bidx] = null;
}
cmp.execOption({
style : set_style
});
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
}
/* setter */
if (true === mf.func.isInclude(clr, 'Color')) {
this.m_border['border-color'] = clr.getStyle();
}
if ('string' === typeof wid) {
this.m_border['border-width'] = wid;
}
} catch (e) {
console.error(e.stack);
throw e;
}
}
handler (fnc, prm) {
try {
if (undefined === fnc) {
/* getter */
return super.handler();
}
/* setter */
let bdr = this.border();
super.hander(
(flg, cmp, prm) => {
try {
bdr(flg, cmp);
fnc(flg, cmp, prm);
} catch (e) {
console.error(e.stack);
throw e;
}
},
prm
);
} catch (e) {
console.error(e.stack);
throw e;
}
}
}
module.exports = mf.event.FocusBdr;
/* end of file */