guy 7 years ago
parent
commit
b7f516cffa
  1. 2
      bi/widget.js
  2. 88
      demo/js/case/demo.calendar.js
  3. 65
      demo/js/widget/date/demo.datepane.js
  4. 2
      dist/bundle.js
  5. 20
      dist/bundle.min.js
  6. 153
      dist/demo.js
  7. 2
      dist/widget.js
  8. 2
      src/widget/datepane/datepane.js

2
bi/widget.js

@ -2639,7 +2639,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DatePaneWidget.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-pane-widget",
baseCls: "bi-date-pane",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
selectedTime: null

88
demo/js/case/demo.calendar.js

@ -2,83 +2,31 @@ Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
_createNav: function(v){
var m = this.MONTH, y = this.YEAR;
m += v;
while(m < 0){
y--;
m += 12;
}
while(m > 11){
y++;
m -= 12;
}
var calendar = BI.createWidget({
render: function () {
var self = this;
var date = new Date();
return {
type: "bi.calendar",
ref: function () {
self.calendar = this;
},
logic: {
dynamic: false
},
year: y,
month: m,
day: this.DAY
})
calendar.setValue(this.selectedTime);
return calendar;
},
_stringfyTimeObject: function(timeOb){
return timeOb.year + "-" + (timeOb.month + 1) + "-" + timeOb.day;
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
}
},
render: function () {
var self = this, d = new Date();
this.YEAR = d.getFullYear();
this.MONTH = d.getMonth();
this.DAY = d.getDate();
this.selectedTime = {
year: this.YEAR,
month: this.MONTH,
day: this.DAY
};
var tip = BI.createWidget({
type: "bi.label"
});
var nav = BI.createWidget({
type: "bi.navigation",
element: this,
tab: {
height: 30,
items: [{
once: false,
text: "后退",
value: -1,
cls: "mvc-button layout-bg3"
},tip, {
once: false,
text: "前进",
value: 1,
cls: "mvc-button layout-bg4"
}]
},
cardCreator: BI.bind(this._createNav, this),
afterCardCreated: function(){
},
afterCardShow: function(){
this.setValue(self.selectedTime);
}
mounted: function () {
var date = new Date();
this.calendar.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
})
nav.on(BI.Navigation.EVENT_CHANGE, function(){
self.selectedTime = nav.getValue();
tip.setText(self._stringfyTimeObject(self.selectedTime));
});
tip.setText(this._stringfyTimeObject(this.selectedTime));
}
});
BI.shortcut("demo.calendar", Demo.Func);

65
demo/js/widget/date/demo.datepane.js

@ -10,43 +10,46 @@ Demo.DatePane = BI.inherit(BI.Widget, {
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.label",
cls: "layout-bg2",
text: "bi.date_pane_widget"
}, {
type: "bi.date_pane_widget",
selectedTime: {
year: 2017,
month: 12,
day: 11
},
ref: function (_ref) {
self.datepane = _ref;
},
height: 300
type: "bi.label",
cls: "layout-bg2",
text: "bi.date_pane"
}, {
type: "bi.date_pane",
selectedTime: {
year: 2017,
month: 12,
day: 11
},
ref: function (_ref) {
self.datepane = _ref;
},
{
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast("date" + JSON.stringify(self.datepane.getValue()));
}
}, {
type: "bi.button",
text: "setVlaue '2017-12-31'",
handler: function () {
self.datepane.setValue({
year: 2017,
month: 11,
day: 31
})
}
height: 300
}, {
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast("date" + JSON.stringify(self.datepane.getValue()));
}
}, {
type: "bi.button",
text: "setValue '2017-12-31'",
handler: function () {
self.datepane.setValue({
year: 2017,
month: 11,
day: 31
})
}
}
],
width: "50%"
}]
}
},
mounted: function () {
this.datepane.setValue();//不设value值表示当前时间
}
})
BI.shortcut("demo.date_pane_widget", Demo.DatePane);
BI.shortcut("demo.date_pane", Demo.DatePane);

2
dist/bundle.js vendored

@ -81023,7 +81023,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DatePaneWidget.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-pane-widget",
baseCls: "bi-date-pane",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
selectedTime: null

20
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

153
dist/demo.js vendored

@ -2021,83 +2021,31 @@ BI.shortcut("demo.text_value_check_combo", Demo.TextValueCheckCombo);Demo.Func =
props: {
baseCls: "demo-func"
},
_createNav: function(v){
var m = this.MONTH, y = this.YEAR;
m += v;
while(m < 0){
y--;
m += 12;
}
while(m > 11){
y++;
m -= 12;
}
var calendar = BI.createWidget({
render: function () {
var self = this;
var date = new Date();
return {
type: "bi.calendar",
ref: function () {
self.calendar = this;
},
logic: {
dynamic: false
},
year: y,
month: m,
day: this.DAY
})
calendar.setValue(this.selectedTime);
return calendar;
},
_stringfyTimeObject: function(timeOb){
return timeOb.year + "-" + (timeOb.month + 1) + "-" + timeOb.day;
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
}
},
render: function () {
var self = this, d = new Date();
this.YEAR = d.getFullYear();
this.MONTH = d.getMonth();
this.DAY = d.getDate();
this.selectedTime = {
year: this.YEAR,
month: this.MONTH,
day: this.DAY
};
var tip = BI.createWidget({
type: "bi.label"
});
var nav = BI.createWidget({
type: "bi.navigation",
element: this,
tab: {
height: 30,
items: [{
once: false,
text: "后退",
value: -1,
cls: "mvc-button layout-bg3"
},tip, {
once: false,
text: "前进",
value: 1,
cls: "mvc-button layout-bg4"
}]
},
cardCreator: BI.bind(this._createNav, this),
afterCardCreated: function(){
},
afterCardShow: function(){
this.setValue(self.selectedTime);
}
mounted: function () {
var date = new Date();
this.calendar.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
})
nav.on(BI.Navigation.EVENT_CHANGE, function(){
self.selectedTime = nav.getValue();
tip.setText(self._stringfyTimeObject(self.selectedTime));
});
tip.setText(this._stringfyTimeObject(this.selectedTime));
}
});
BI.shortcut("demo.calendar", Demo.Func);Demo.Func = BI.inherit(BI.Widget, {
@ -7479,46 +7427,49 @@ BI.shortcut("demo.date", Demo.Date);Demo.DatePane = BI.inherit(BI.Widget, {
type: "bi.vertical",
vgap: 10,
items: [{
type: "bi.label",
cls: "layout-bg2",
text: "bi.date_pane_widget"
}, {
type: "bi.date_pane_widget",
selectedTime: {
year: 2017,
month: 12,
day: 11
},
ref: function (_ref) {
self.datepane = _ref;
},
height: 300
type: "bi.label",
cls: "layout-bg2",
text: "bi.date_pane"
}, {
type: "bi.date_pane",
selectedTime: {
year: 2017,
month: 12,
day: 11
},
{
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast("date" + JSON.stringify(self.datepane.getValue()));
}
}, {
type: "bi.button",
text: "setVlaue '2017-12-31'",
handler: function () {
self.datepane.setValue({
year: 2017,
month: 11,
day: 31
})
}
ref: function (_ref) {
self.datepane = _ref;
},
height: 300
}, {
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast("date" + JSON.stringify(self.datepane.getValue()));
}
}, {
type: "bi.button",
text: "setValue '2017-12-31'",
handler: function () {
self.datepane.setValue({
year: 2017,
month: 11,
day: 31
})
}
}
],
width: "50%"
}]
}
},
mounted: function () {
this.datepane.setValue();//不设value值表示当前时间
}
})
BI.shortcut("demo.date_pane_widget", Demo.DatePane);/**
BI.shortcut("demo.date_pane", Demo.DatePane);/**
* Created by Urthur on 2017/7/18.
*/
Demo.CustomDateTime = BI.inherit(BI.Widget, {

2
dist/widget.js vendored

@ -2639,7 +2639,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DatePaneWidget.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-pane-widget",
baseCls: "bi-date-pane",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
selectedTime: null

2
src/widget/datepane/datepane.js

@ -5,7 +5,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DatePaneWidget.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-pane-widget",
baseCls: "bi-date-pane",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
selectedTime: null

Loading…
Cancel
Save