Browse Source

no message

master
刘荣歆 7 years ago
parent
commit
0494662c2f
  1. 54
      demo/js/widget/filemanager/demo.file.manager.js
  2. 43
      src/widget/dailertest/combo.date.time.js
  3. 22
      src/widget/dailertest/number.spinner.js
  4. 55
      src/widget/dailertest/popup.date.time.js
  5. 29
      src/widget/dailertest/time.spinner.js
  6. 71
      src/widget/dailertest/trigger.date.time.js

54
demo/js/widget/filemanager/demo.file.manager.js

@ -0,0 +1,54 @@
/*
Created by dailer on 2017 / 7 / 21.
*/
Demo.FileManager = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var items = [{
id: "1",
value: "1",
text: "根目录",
lastModify: 1454316355142
}, {
id: "11",
pId: "1",
value: "11",
text: "第一级子目录1",
lastModify: 1454316355142
}, {
id: "12",
pId: "1",
value: "12",
text: "第一级子目录2",
lastModify: 1454316355142
}, {
id: "111",
pId: "11",
value: "111",
text: "第二级子目录",
lastModify: 1454316355142
}, {
id: "121",
pId: "111",
buildUrl: "www.baidu.com",
value: "111",
text: "文件2",
lastModify: 1454316355142
}, {
id: "122",
pId: "111",
buildUrl: "www.baidu.com",
value: "112",
text: "文件3",
lastModify: 1454316355142
}];
return {
type: "bi.file_manager",
items: items
}
}
});
BI.shortcut("demo.file_manager", Demo.FileManager);

43
src/widget/dailertest/combo.datetime.js → src/widget/dailertest/combo.date.time.js

@ -25,7 +25,7 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, {
o = this.options;
this.trigger = BI.createWidget({
type: "bi.date_trigger"
type: "bi.date_time_trigger1"
});
this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () {
@ -36,13 +36,21 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, {
type: "bi.date_time_popup"
});
this.popup.on(BI.DateCalendarPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
this.popup.on(BI.DateTimePopup.EVENT_CHANGE, function () {
//self.setValue(self.popup.getValue());
});
this.popup.on(BI.DateTimePopup.EVENT_CLICK_CONFIRM, function () {
//do something here
self.setValue();
self.combo.hideView();
});
this.popup.on(BI.DateTimePopup.EVENT_CLICK_CANCEL, function () {
self.combo.hideView();
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
toggle: true,
element: this,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
@ -56,29 +64,8 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, {
},
_reviseMinute: function () {
this.m._finetuning(this.s.isNeedRevise);
this._reviseHour();
},
_reviseHour: function () {
this.h._finetuning(this.m.isNeedRevise);
},
getCurrentTime: function () {
return {
hour: this.h.getValue(),
minute: this.m.getValue(),
second: this.s.getValue()
};
},
_format: function (p) {
return p < 10 ? ('0' + p) : p
},
getCurrentTimeStr: function () {
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue())
getValue: function () {
return this.popup.getValue();
},
setStep: function (step) {
@ -86,7 +73,7 @@ BI.DateTimeCombo = BI.inherit(BI.Widget, {
},
setValue: function (v) {
this.trigger.setValue(this.popup.getValue());
}
});

22
src/widget/dailertest/tuningnumbereditor.js → src/widget/dailertest/number.spinner.js

@ -2,12 +2,11 @@
* Created by dailer on 2017/7/18.
* 数值微调器练习
*/
BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
BI.NumberSpinner = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FineTuningNumberEditor.superclass._defaultConfig.apply(this, arguments), {
return BI.extend(BI.NumberSpinner.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-fine-tuning-number-editor bi-border",
value: 0,
disabled: false,
min: 0,
max: 100000,
step: 1,
@ -17,7 +16,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
},
_init: function () {
BI.FineTuningNumberEditor.superclass._init.apply(this, arguments);
BI.NumberSpinner.superclass._init.apply(this, arguments);
var self = this,
o = this.options;
if (o.formatter == BI.emptyFn) {
@ -42,7 +41,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
});
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () {
self.setValue(self.editor.getValue());
self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM);
self.fireEvent(BI.NumberSpinner.EVENT_CONFIRM);
});
@ -52,11 +51,10 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom",
});
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._isNeedRevise();
self._finetuning(1);
self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM);
self.fireEvent(BI.NumberSpinner.EVENT_CONFIRM);
});
this.bottomBtn = BI.createWidget({
@ -66,7 +64,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
});
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () {
self._finetuning(-1);
self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM);
self.fireEvent(BI.NumberSpinner.EVENT_CONFIRM);
});
this._finetuning(0);
@ -119,8 +117,8 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
},
_isNeedRevise: function () {
// console.log(this.editor.getValue() - this.value);
getIsNeedRevise: function () {
return this.isNeedRevise;
},
getMinAndMax: function () {
@ -148,5 +146,5 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, {
}
});
BI.FineTuningNumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.test_editor", BI.FineTuningNumberEditor);
BI.NumberSpinner.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.test_editor", BI.NumberSpinner);

55
src/widget/dailertest/popup.date_time.js → src/widget/dailertest/popup.date.time.js

@ -7,7 +7,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DateTimePopup.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-calendar-popup",
baseCls: "bi-date-calendar-popup demo-clolor",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
selectedTime: null
@ -38,16 +38,23 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
this._year = this.today.getFullYear();
this._month = this.today.getMonth();
this._day = this.today.getDate();
this._hour = this.today.getHours();
this._minute = this.today.getMinutes();
this._second = this.today.getSeconds();
this.selectedTime = o.selectedTime || {
year: this._year,
month: this._month,
day: this._day
day: this._day,
hour: this._hour,
minute: this._minute,
second: this._second
};
this.datePicker = BI.createWidget({
type: "bi.date_picker",
min: o.min,
max: o.max
max: o.max,
cls: "demo-clolor",
});
this.calendar = BI.createWidget({
@ -66,21 +73,42 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
afterCardShow: function () {
this.setValue(self.selectedTime);
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime));
}
});
this.timeTunning = BI.createWidget({
type: "bi.time_tunning"
type: "bi.time_tunning",
currentTime: {
hour: this._hour,
minute: this._minute,
second: this._second
}
});
this.timeTunning.on(BI.TimeTuning.EVENT_CHANGE, function () {
self.selectedTime = self.timeTunning.getValue();
});
this.buttons = BI.createWidget({
type: "bi.button_group",
items: [{
type: "bi.text_button",
text: BI.i18nText('BI-Basic_Clears')
type: "bi.button",
textHeight: 30,
clear: true,
text: "取消",
handler: function () {
self.fireEvent(BI.DateTimePopup.EVENT_CLICK_CANCEL);
}
}, {
type: "bi.text_button",
text: BI.i18nText("BI-Basic_Sure")
text: "|"
}, {
type: "bi.button",
textHeight: 30,
clear: true,
text: BI.i18nText("BI-Basic_Sure"),
handler: function () {
self.fireEvent(BI.DateTimePopup.EVENT_CLICK_CONFIRM);
}
}],
chooseType: 0,
behaviors: {},
@ -103,21 +131,26 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () {
self.selectedTime = self.calendar.getValue();
self.setValue(self.selectedTime);
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE);
self.fireEvent(BI.DateTimePopup.EVENT_CHANGE);
});
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime));
this.calendar.setValue(this.selectedTime);
},
setValue: function (timeOb) {
this.datePicker.setValue(timeOb);
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(timeOb));
this.calendar.setValue(timeOb);
this.timeTunning.setValue(timeOb);
this.selectedTime = timeOb;
},
getValue: function () {
return this.selectedTime;
return $.extend({}, this.calendar.getValue(), this.timeTunning.getValue());
}
});
BI.DateTimePopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.DateTimePopup.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.DateTimePopup.EVENT_CLICK_CANCEL = "EVENT_CLICK_CANCEL";
BI.shortcut("bi.date_time_popup", BI.DateTimePopup);

29
src/widget/dailertest/timetunning.js → src/widget/dailertest/time.spinner.js

@ -49,7 +49,9 @@ BI.TimeTuning = BI.inherit(BI.Widget, {
width: 60,
height: 30
});
this.h.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () {});
this.h.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TimeTuning.EVENT_CHANGE);
});
//分
this.m = BI.createWidget({
@ -62,6 +64,7 @@ BI.TimeTuning = BI.inherit(BI.Widget, {
})
this.m.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () {
self._reviseHour();
self.fireEvent(BI.TimeTuning.EVENT_CHANGE);
});
//秒
@ -75,6 +78,7 @@ BI.TimeTuning = BI.inherit(BI.Widget, {
})
this.s.on(BI.FineTuningNumberEditor.EVENT_CONFIRM, function () {
self._reviseMinute();
self.fireEvent(BI.TimeTuning.EVENT_CHANGE);
});
@ -107,7 +111,7 @@ BI.TimeTuning = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.htape",
cls: "bi-border demo-clolor",
cls: "demo-clolor",
element: this,
items: [this.editor],
width: 270,
@ -116,12 +120,12 @@ BI.TimeTuning = BI.inherit(BI.Widget, {
},
_reviseMinute: function () {
this.m._finetuning(this.s.isNeedRevise);
this.m._finetuning(this.s.getIsNeedRevise());
this._reviseHour();
},
_reviseHour: function () {
this.h._finetuning(this.m.isNeedRevise);
this.h._finetuning(this.m.getIsNeedRevise());
},
getCurrentTime: function () {
@ -140,15 +144,24 @@ BI.TimeTuning = BI.inherit(BI.Widget, {
return this._format(this.h.getValue()) + ':' + this._format(this.m.getValue()) + ':' + this._format(this.s.getValue())
},
getValue: function () {
return {
hour: this.h.getValue(),
minute: this.m.getValue(),
second: this.s.getValue()
}
},
setStep: function (step) {
this.step = step || this.step;
},
setValue: function (v) {
this.value = v;
this.editor.setValue();
setValue: function (timeObj) {
this.h.setValue(timeObj.hour);
this.m.setValue(timeObj.minute);
this.s.setValue(timeObj.second);
}
});
BI.TimeTuning.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.TimeTuning.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.time_tunning", BI.TimeTuning);

71
src/widget/dailertest/trigger.date.time.js

@ -0,0 +1,71 @@
BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () {
return BI.extend(BI.DateTimeTrigger.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-date-trigger",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
height: 32
});
},
_init: function () {
BI.DateTimeTrigger.superclass._init.apply(this, arguments);
var self = this,
o = this.options;
this.label = BI.createWidget({
type: "bi.label",
textAlign: "left",
text: "",
height: o.height
});
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: BI.createWidget({
type: "bi.icon_button",
cls: "search-font"
}),
width: 30
}, {
el: this.label
}]
})
var today = new Date(),
timeObj = {
year: today.getFullYear(),
month: today.getMonth(),
day: today.getDate(),
hour: today.getHours(),
minute: today.getMinutes(),
second: today.getSeconds()
};
this.setValue(timeObj);
},
_parseTimeObjToStr: function (timeObj) {
var _format = function (p) {
return p < 10 ? ('0' + p) : p
};
BI.each(timeObj, function (key, val) {
timeObj[key] = _format(timeObj[key]);
});
return timeObj.year + "-" + (1 + BI.parseInt(timeObj.month)) + "-" + timeObj.day + " " + timeObj.hour + ":" + timeObj.minute + ":" + timeObj.second;
},
setValue: function (v) {
this.label.setValue(this._parseTimeObjToStr(v));
},
getValue: function () {
}
});
BI.shortcut("bi.date_time_trigger1", BI.DateTimeTrigger);
Loading…
Cancel
Save