Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~teller/fineui

es6
iapyang 3 years ago
parent
commit
20fb288b2a
  1. 2
      package.json
  2. 6
      src/base/combination/combo.js
  3. 6
      src/case/calendar/calendar.date.item.js
  4. 16
      src/case/calendar/calendar.js
  5. 1
      src/core/constant/var.js
  6. 56
      src/widget/date/calendar/picker.date.js
  7. 4
      src/widget/date/calendar/popup.calendar.date.js

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20211101114140", "version": "2.0.20211102143200",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

6
src/base/combination/combo.js

@ -312,7 +312,7 @@
delete needHideWhenAnotherComboOpen[this.getName()]; delete needHideWhenAnotherComboOpen[this.getName()];
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName());
this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW); this.fireEvent(BI.Combo.EVENT_AFTER_HIDEVIEW);
}, },
@ -336,10 +336,10 @@
this.element.addClass(this.options.comboClass); this.element.addClass(this.options.comboClass);
BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName()); BI.Widget._renderEngine.createElement(document).unbind("mousedown." + this.getName()).unbind("mousewheel." + this.getName());
o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName()); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).unbind("blur." + this.getName());
BI.Widget._renderEngine.createElement(document).bind("mousedown." + this.getName(), BI.bind(this._hideIf, this)).bind("mousewheel." + this.getName(), BI.bind(this._hideIf, this)); BI.Widget._renderEngine.createElement(document).bind("mousedown." + this.getName(), BI.bind(this._hideIf, this)).bind("mousewheel." + this.getName(), BI.bind(this._hideIf, this));
o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).bind("blur." + this.getName(), BI.bind(this._hideIf, this)); BI.EVENT_BLUR && o.hideWhenBlur && BI.Widget._renderEngine.createElement(window).bind("blur." + this.getName(), BI.bind(this._hideIf, this));
this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW); this.fireEvent(BI.Combo.EVENT_AFTER_POPUPVIEW);
}, },

6
src/case/calendar/calendar.date.item.js

@ -21,8 +21,8 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
}, },
left: o.lgap, left: o.lgap,
right: o.rgap, right: o.rgap,
top: 0, top: o.tgap,
bottom: 0 bottom: o.rgap
}] }]
}; };
}, },
@ -50,4 +50,4 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
return this.text.getValue(); return this.text.getValue();
} }
}); });
BI.shortcut("bi.calendar_date_item", BI.CalendarDateItem); BI.shortcut("bi.calendar_date_item", BI.CalendarDateItem);

16
src/case/calendar/calendar.js

@ -100,8 +100,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
columns: 7, columns: 7,
rows: 6, rows: 6,
columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7], columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7],
rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 10
vgap: 10
}))] }))]
}); });
this.days.on(BI.Controller.EVENT_CHANGE, function () { this.days.on(BI.Controller.EVENT_CHANGE, function () {
@ -111,7 +110,10 @@ BI.Calendar = BI.inherit(BI.Widget, {
element: this element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, { }, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("top", title, this.days) items: BI.LogicFactory.createLogicItemsByDirection("top", title, {
el: this.days,
tgap: -5
})
})))); }))));
}, },
@ -159,11 +161,13 @@ BI.Calendar = BI.inherit(BI.Widget, {
whiteSpace: "normal", whiteSpace: "normal",
once: false, once: false,
forceSelected: true, forceSelected: true,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 10,
value: o.year + "-" + month + "-" + td.text, value: o.year + "-" + month + "-" + td.text,
disabled: td.lastMonth || td.nextMonth || td.disabled, disabled: td.lastMonth || td.nextMonth || td.disabled,
lgap: 5, lgap: 5,
rgap: 5 rgap: 5,
tgap: 5,
bgap: 5
// selected: td.currentDay // selected: td.currentDay
}); });
}); });
@ -231,4 +235,4 @@ BI.extend(BI.Calendar, {
} }
}); });
BI.shortcut("bi.calendar", BI.Calendar); BI.shortcut("bi.calendar", BI.Calendar);

1
src/core/constant/var.js

@ -6,6 +6,7 @@ _.extend(BI, {
MAX: 0xfffffffffffffff, MAX: 0xfffffffffffffff,
MIN: -0xfffffffffffffff, MIN: -0xfffffffffffffff,
EVENT_RESPONSE_TIME: 200, EVENT_RESPONSE_TIME: 200,
EVENT_BLUR: true,
zIndex_layer: 1e5, zIndex_layer: 1e5,
zIndex_popover: 1e6, zIndex_popover: 1e6,
zIndex_popup: 1e7, zIndex_popup: 1e7,

56
src/widget/date/calendar/picker.date.js

@ -11,31 +11,32 @@ BI.DatePicker = BI.inherit(BI.Widget, {
baseCls: "bi-date-picker", baseCls: "bi-date-picker",
height: 40, height: 40,
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31" // 最大日期
}); });
}, },
_init: function () { _init: function () {
BI.DatePicker.superclass._init.apply(this, arguments); BI.DatePicker.superclass._init.apply(this, arguments);
var self = this; var o = this.options; var self = this;
var o = this.options;
this._year = BI.getDate().getFullYear(); this._year = BI.getDate().getFullYear();
this._month = BI.getDate().getMonth() + 1; this._month = BI.getDate().getMonth() + 1;
this.left = BI.createWidget({ this.left = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "pre-page-h-font", cls: "pre-page-h-font",
width: 24, width: 24,
height: 24, height: 24
}); });
this.left.on(BI.IconButton.EVENT_CHANGE, function () { this.left.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 1) { if (self._month === 1) {
self.setValue({ self.setValue({
year: (self.year.getValue() - 1) || (BI.getDate().getFullYear() - 1), year: (self.year.getValue() - 1) || (BI.getDate().getFullYear() - 1),
month: 12, month: 12
}); });
} else { } else {
self.setValue({ self.setValue({
year: self.year.getValue() || BI.getDate().getFullYear(), year: self.year.getValue() || BI.getDate().getFullYear(),
month: (self.month.getValue() - 1) || BI.getDate().getMonth(), month: (self.month.getValue() - 1) || BI.getDate().getMonth()
}); });
} }
self.fireEvent(BI.DatePicker.EVENT_CHANGE); self.fireEvent(BI.DatePicker.EVENT_CHANGE);
@ -47,19 +48,19 @@ BI.DatePicker = BI.inherit(BI.Widget, {
type: "bi.icon_button", type: "bi.icon_button",
cls: "next-page-h-font", cls: "next-page-h-font",
width: 24, width: 24,
height: 24, height: 24
}); });
this.right.on(BI.IconButton.EVENT_CHANGE, function () { this.right.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 12) { if (self._month === 12) {
self.setValue({ self.setValue({
year: (self.year.getValue() + 1) || (BI.getDate().getFullYear() + 1), year: (self.year.getValue() + 1) || (BI.getDate().getFullYear() + 1),
month: 1, month: 1
}); });
} else { } else {
self.setValue({ self.setValue({
year: self.year.getValue() || BI.getDate().getFullYear(), year: self.year.getValue() || BI.getDate().getFullYear(),
month: (self.month.getValue() + 1) || (BI.getDate().getMonth() + 2), month: (self.month.getValue() + 1) || (BI.getDate().getMonth() + 2)
}); });
} }
self.fireEvent(BI.DatePicker.EVENT_CHANGE); self.fireEvent(BI.DatePicker.EVENT_CHANGE);
@ -71,7 +72,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
type: "bi.year_date_combo", type: "bi.year_date_combo",
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.min,
max: o.max, max: o.max
}); });
this.year.on(BI.YearDateCombo.EVENT_CHANGE, function () { this.year.on(BI.YearDateCombo.EVENT_CHANGE, function () {
self.setValue({ self.setValue({
@ -91,7 +92,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () { this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () {
self.setValue({ self.setValue({
year: self.year.getValue() || self._year, year: self.year.getValue() || self._year,
month: self.month.getValue(), month: self.month.getValue()
}); });
self.fireEvent(BI.DatePicker.EVENT_CHANGE); self.fireEvent(BI.DatePicker.EVENT_CHANGE);
}); });
@ -105,33 +106,26 @@ BI.DatePicker = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.left], items: [this.left]
}, },
width: 24, width: 24
}, { }, {
type: "bi.center_adapt", el: {
items: [{ type: "bi.center_adapt",
el: { hgap: 10,
type: "bi.horizontal", items: [this.year, this.month]
width: 120, }
rgap: 10,
items: [{
el: this.year,
lgap: 10,
}, this.month],
},
}],
}, { }, {
el: { el: {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.right], items: [this.right]
}, },
width: 24, width: 24
}], }]
}); });
this.setValue({ this.setValue({
year: this._year, year: this._year,
month: this._month, month: this._month
}); });
}, },
@ -177,7 +171,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
return valid; return valid;
}, },
_getCheckMinMaxDate: function() { _getCheckMinMaxDate: function () {
var o = this.options; var o = this.options;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); var maxDate = BI.parseDateTime(o.max, "%Y-%X-%d");
@ -219,9 +213,9 @@ BI.DatePicker = BI.inherit(BI.Widget, {
getValue: function () { getValue: function () {
return { return {
year: this.year.getValue(), year: this.year.getValue(),
month: this.month.getValue(), month: this.month.getValue()
}; };
}, }
}); });
BI.DatePicker.EVENT_CHANGE = "EVENT_CHANGE"; BI.DatePicker.EVENT_CHANGE = "EVENT_CHANGE";
BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW";

4
src/widget/date/calendar/popup.calendar.date.js

@ -88,7 +88,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
items: [{ items: [{
el: this.calendar, el: this.calendar,
hgap: 5, hgap: 5,
bgap: 12 bgap: 7
}] }]
}, { }, {
type: "bi.absolute", type: "bi.absolute",
@ -148,4 +148,4 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
}); });
BI.DateCalendarPopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.DateCalendarPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW";
BI.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup); BI.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup);

Loading…
Cancel
Save