Skip to content

Commit 25bbdf1

Browse files
JC.Calendar monthday, clear add preserveDisabled html prop
1 parent f15d9cb commit 25bbdf1

File tree

4 files changed

+79
-5
lines changed

4 files changed

+79
-5
lines changed

deploy/normal/modules/JC.Calendar/0.2/Calendar.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs_api/files/.._modules_JC.Calendar_0.2_Calendar.js.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2619,6 +2619,37 @@ <h1 class="file-heading">File: ../modules/JC.Calendar/0.2/Calendar.js</h1>
26192619
return _r;
26202620
};
26212621

2622+
2623+
MonthDayModel.prototype.ccPreserveDisabled =
2624+
function(){
2625+
var _r = true;
2626+
this.selector().is( &#x27;[ccPreserveDisabled]&#x27; )
2627+
&amp;&amp; ( _r = JC.f.parseBool( this.selector().attr( &#x27;ccPreserveDisabled&#x27; ) ) );
2628+
return _r;
2629+
};
2630+
2631+
MonthDayModel.prototype.calendarclear =
2632+
function(){
2633+
var _p = this, _ipt = this.selector(), _cb, _tmp;
2634+
_ipt &amp;&amp; _ipt.attr(&#x27;calendarclear&#x27;)
2635+
&amp;&amp; ( _tmp = window[ _ipt.attr(&#x27;calendarclear&#x27;) ] )
2636+
&amp;&amp; ( _cb = _tmp );
2637+
2638+
if( _p.ccPreserveDisabled() ){
2639+
var _items = _p.layout().find( &#x27;input[date]&#x27; ), _disabled = [];
2640+
_items.each( function(){
2641+
var _sp = $(this), _d;
2642+
if( !( _sp.is( &#x27;:disabled&#x27; ) &amp;&amp; _sp.is( &#x27;:checked&#x27; ) ) ) return;
2643+
_d = new Date();
2644+
_d.setTime( _sp.attr( &#x27;date&#x27; ) );
2645+
_disabled.push( JC.f.formatISODate( _d ) );
2646+
});
2647+
_ipt.val( _disabled.join(&#x27;,&#x27;) );
2648+
}
2649+
2650+
return _cb;
2651+
};
2652+
26222653
MonthDayView.prototype.updateSelected =
26232654
function( _userSelectedItem ){
26242655
var _p = this

modules/JC.Calendar/0.2/Calendar.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,6 +2435,37 @@
24352435
return _r;
24362436
};
24372437

2438+
2439+
MonthDayModel.prototype.ccPreserveDisabled =
2440+
function(){
2441+
var _r = true;
2442+
this.selector().is( '[ccPreserveDisabled]' )
2443+
&& ( _r = JC.f.parseBool( this.selector().attr( 'ccPreserveDisabled' ) ) );
2444+
return _r;
2445+
};
2446+
2447+
MonthDayModel.prototype.calendarclear =
2448+
function(){
2449+
var _p = this, _ipt = this.selector(), _cb, _tmp;
2450+
_ipt && _ipt.attr('calendarclear')
2451+
&& ( _tmp = window[ _ipt.attr('calendarclear') ] )
2452+
&& ( _cb = _tmp );
2453+
2454+
if( _p.ccPreserveDisabled() ){
2455+
var _items = _p.layout().find( 'input[date]' ), _disabled = [];
2456+
_items.each( function(){
2457+
var _sp = $(this), _d;
2458+
if( !( _sp.is( ':disabled' ) && _sp.is( ':checked' ) ) ) return;
2459+
_d = new Date();
2460+
_d.setTime( _sp.attr( 'date' ) );
2461+
_disabled.push( JC.f.formatISODate( _d ) );
2462+
});
2463+
_ipt.val( _disabled.join(',') );
2464+
}
2465+
2466+
return _cb;
2467+
};
2468+
24382469
MonthDayView.prototype.updateSelected =
24392470
function( _userSelectedItem ){
24402471
var _p = this

modules/JC.Calendar/0.2/_demo/demo.monthday.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,22 @@
3636
<form action='' method='get'>
3737
<dl>
3838
<dt>JC.Calendar 示例</dt>
39-
<dd><input type="text" name="date1" multidate="monthday" size="80" class="js_minDate" />monthday, js_minDate</dd>
40-
<dd><input type="text" name="date1" multidate="monthday" size="80" class="js_maxDate" />monthday, js_maxDate</dd>
41-
<dd><input type="text" name="date1" multidate="monthday" size="80" class="js_maxDate" value="1952-01-30" />monthday</dd>
42-
<dd><input type="text" name="date1" datatype="monthday" size="80" defaultdate="2013-11-14" />monthday, defaultdate</dd>
39+
<dd><input type="text" name="date1" size="80" multidate="monthday" class="js_minDate" />monthday, js_minDate</dd>
40+
<dd>
41+
<input type="text" name="date1" size="80"
42+
multidate="monthday"
43+
minvalue="now"
44+
/>monthday, minvalue="now"
45+
</dd>
46+
<input type="text" name="date1" size="80"
47+
multidate="monthday"
48+
value="now-1d"
49+
minvalue="now"
50+
/>monthday, minvalue="now"
51+
</dd>
52+
<dd><input type="text" name="date1" size="80" multidate="monthday" class="js_maxDate" />monthday, js_maxDate</dd>
53+
<dd><input type="text" name="date1" size="80" multidate="monthday" class="js_maxDate" value="1952-01-30" />monthday</dd>
54+
<dd><input type="text" name="date1" size="80" datatype="monthday" defaultdate="2013-11-14" />monthday, defaultdate</dd>
4355
<dd><textarea name="date1" datatype="monthday" defaultdate="2013-11-14" cols="66" rows="5" ></textarea>monthday, defaultdate</dd>
4456
<dd>
4557
<input type="text" name="date2" datatype="date" value="" />

0 commit comments

Comments
 (0)