Skip to content

Commit 6a6df00

Browse files
committed
a
1 parent 92dd8e3 commit 6a6df00

File tree

6 files changed

+188
-7
lines changed

6 files changed

+188
-7
lines changed

modules/JC.FrameUtil/0.1/FrameUtil.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@
7979
, noticeSize:
8080
function( _type ){
8181
try{
82-
_type = FU.type( _type );
83-
if( ! FU.parent() ) return FU;
82+
83+
_type = FU.type( _type );
84+
85+
if( ! FU.parent() ) return FU;
8486
var _ext = { 'type': _type };
8587
FU.parent().jEventHost.trigger( 'size', [ FU.info( _ext ) ] );
8688
}catch(ex){
@@ -124,6 +126,26 @@
124126
$( FU.eventHost ).on( _name, _cb );
125127
return FU;
126128
}
129+
130+
/**
131+
* 订阅 父级frame 的事件
132+
* <br />目前有以下事件:
133+
* <br />close: 关闭
134+
* <br />size: 更新大小
135+
* <br />data: json 数据
136+
* @method subscribeParentEvent
137+
* @param {string} _name
138+
* @param {function} _cb
139+
*/
140+
, subscribeParentEvent:
141+
function( _name, _cb ){
142+
if( !_name ) return FU;
143+
144+
FU.parent() &&
145+
FU.parent().jEventHost.on( _name, _cb );
146+
return FU;
147+
}
148+
127149
/**
128150
* 通知父级有数据交互
129151
* @method noticeData
@@ -185,9 +207,9 @@
185207
, noticeChildData:
186208
function( _params, _type ){
187209
if( !(_params) ) return FU;
188-
_params.type = FU.type( _type ) || _params.type;
210+
// _params.type = FU.type( _type ) || _params.type;
189211

190-
FU.info().jEventHost.trigger( 'childData', FU.info( _params ) );
212+
FU.info().jEventHost.trigger( _type ? _type : 'childData', FU.info( _params ) );
191213
return FU;
192214
}
193215
/**

modules/JC.FrameUtil/0.1/_demo/data/childToParent.noticeChildData.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<script>
4848
JC.debug = true;
4949

50+
5051
requirejs( [ 'JC.Calendar', 'Bizs.FormLogic', 'Bizs.CommonModify', 'JC.FrameUtil' ]
5152
, function( Calendar, FormLogic ){
5253

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset=utf-8 />
5+
<title>Open JQuery Components Library - suches</title>
6+
<style>
7+
* {
8+
}
9+
html {
10+
overflow-y: hidden;
11+
height: 100px;
12+
}
13+
legend {
14+
margin: 10px 0;
15+
}
16+
17+
</style>
18+
19+
</head>
20+
<body>
21+
<p></p>
22+
23+
<script src="../../../../../lib.js"></script>
24+
<script src="../../../../../config.js"></script>
25+
<script>
26+
JC.debug = true;
27+
28+
requirejs( [ 'Bizs.CommonModify', 'JC.FrameUtil' ], function(){
29+
JC.FrameUtil.autoNoticeSize();
30+
31+
JC.FrameUtil.subscribeParentEvent( 'childData', function( _evt, _params ) {
32+
33+
if( _params && _params.data ) {
34+
$('p').html( _params.data );
35+
}
36+
37+
} );
38+
39+
JC.FrameUtil.subscribeParentEvent( 'event2', function( _evt, _params ) {
40+
41+
if( _params && _params.data ) {
42+
$('p').html( _params.data );
43+
}
44+
45+
} );
46+
47+
JC.FrameUtil.subscribeParentEvent( 'event3', function( _evt, _params ) {
48+
49+
if( _params && _params.data ) {
50+
$('p').html( _params.data );
51+
}
52+
53+
} );
54+
});
55+
56+
</script>
57+
</body>
58+
</html>
59+
60+

modules/JC.FrameUtil/0.1/_demo/demo.childToParent.noticeChildData.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
var _frame = JC.FrameUtil.childIdMap( _params.id );
4747
if( _frame && _frame.length ){
4848
alert( [ 'finded', JSON.stringify( _params.data ) ].join( '\n\n' ) );
49+
JC.FrameUtil.noticeChildData( _params );
4950
}
5051
});
5152

@@ -57,7 +58,7 @@
5758
_params.data = {
5859
'inputvalue': 'dddddddddddddd' + JC.f.ts()
5960
};
60-
JC.FrameUtil.noticeChildData( _params );
61+
//JC.FrameUtil.noticeChildData( _params );
6162
}
6263
});
6364
});
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset=utf-8 />
5+
<title>JC.FrameUtil - Open JQuery Components Library - suches</title>
6+
<style>
7+
body{
8+
margin: 20px 40px;
9+
}
10+
11+
.ipt,.txt,.txt-1{ border:1px solid #e2e3ea; border-top:1px solid #abadb3; border-radius:2px; height:22px; *line-height:22px;}
12+
.ipt{ width:126px;}
13+
.ipt-w58{ width:58px;}
14+
.ipt-w48{ width:48px; text-align:center;}
15+
.ipt-w80{ width:80px;}
16+
.ipt-w180{ width:180px;}
17+
.ipt-w230{ width: 230px;}
18+
.ipt-w320{ width:320px;}
19+
.ipt-w380{ width:380px;}
20+
.ipt-w480{ width:480px;}
21+
.ipt-w545{ width:545px;}
22+
.txt,.txt-1{ resize:none; height:50px; width:99.8%;}
23+
.txt-w280{ width:280px;}
24+
.txt-w480{ width:480px;}
25+
.txt-w545{ width:545px;}
26+
.txt-w400{ width:410px;}
27+
.txt-w380{ width:380px;}
28+
.txt-w650{ width:650px;}
29+
30+
.defDl > dd{
31+
border-bottom:1px solid #e2e3ea;
32+
}
33+
34+
.frame {
35+
width: 100%;
36+
}
37+
38+
legend {
39+
margin: 10px 0;
40+
}
41+
42+
button {
43+
margin: 5px;
44+
}
45+
46+
</style>
47+
<link href='../../../../modules/JC.Panel/0.2/res/default/style.css' rel='stylesheet' />
48+
49+
</head>
50+
<body>
51+
<h2>JC.FrameUtil - parent to children - data传递 - 示例</h2>
52+
53+
<div style="width:35%;float:left;">
54+
父页面表单信息:
55+
<button class="event1">event 1</button>
56+
<button class="event2">event 2</button>
57+
<button class="event3">event 3</button>
58+
</div>
59+
<dl style="width:60%;float:right;margin-top:0;" class="defDl">
60+
<dt style="margin-bottom:10px;">子页面:</dt>
61+
<dd>
62+
<iframe src="./data/parentToChild.data.html" id="frame1" class="frame" name="f1"></iframe>
63+
</dd>
64+
</dl>
65+
66+
<script src="../../../../lib.js"></script>
67+
<script src="../../../../config.js"></script>
68+
<script>
69+
JC.debug = true;
70+
71+
requirejs( [ 'JC.FrameUtil' ], function(){
72+
73+
$( '.event1' ).on( 'click', function() {
74+
JC.FrameUtil.noticeChildData( {
75+
data: 'event1'
76+
} );
77+
} );
78+
79+
$( '.event2' ).on( 'click', function() {
80+
JC.FrameUtil.noticeChildData( {
81+
data: 'event2'
82+
}, 'event2' );
83+
} );
84+
85+
$( '.event3' ).on( 'click', function() {
86+
JC.FrameUtil.noticeChildData( {
87+
data: 'event3'
88+
}, 'event3' );
89+
} );
90+
91+
} );
92+
</script>
93+
</body>
94+
</html>
95+
96+

modules/JC.Slider/0.1/Slider.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,7 @@
801801
(
802802
this._model.width() -
803803
Math.floor( this._model.width() / this._model.itemwidth() ) * this._model.itemwidth()
804-
)
805-
/ ( this._model.totalpage() - 1 );
804+
) / ( this._model.totalpage() - 1 );
806805
this._itemspace = parseInt( this._itemspace );
807806

808807
this._init();
@@ -873,10 +872,12 @@
873872
}
874873

875874
_oldpointer === (_p._model.totalpage() - 1 )
875+
&& _p._model.totalpage() > 2
876876
&& _newpointer === 0
877877
&& ( _begin = this._model.width() + this._itemspace, _isPlus = false );
878878

879879
_oldpointer === 0
880+
&& _p._model.totalpage() > 2
880881
&& _newpointer === (_p._model.totalpage() - 1 )
881882
&& ( _begin = -( this._model.width() + this._itemspace ), _isPlus = true );
882883

0 commit comments

Comments
 (0)