Browse Source
* commit 'ec09f56020ffb78c8209bf8abbc96227e4611d7c': BI-41100 refactor: 删date_time_select && float_center_adaptes6
windy
6 years ago
19 changed files with 340 additions and 2037 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,74 +0,0 @@
|
||||
/** |
||||
* 浮动的居中布局 |
||||
*/ |
||||
BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, { |
||||
props: function () { |
||||
return BI.extend(BI.FloatCenterAdaptLayout.superclass.props.apply(this, arguments), { |
||||
baseCls: "bi-float-center-adapt-layout", |
||||
items: [], |
||||
hgap: 0, |
||||
vgap: 0, |
||||
tgap: 0, |
||||
bgap: 0, |
||||
lgap: 0, |
||||
rgap: 0 |
||||
}); |
||||
}, |
||||
render: function () { |
||||
BI.FloatCenterAdaptLayout.superclass.render.apply(this, arguments); |
||||
this.populate(this.options.items); |
||||
}, |
||||
|
||||
resize: function () { |
||||
// console.log("float_center_adapt布局不需要resize");
|
||||
}, |
||||
|
||||
addItem: function () { |
||||
// do nothing
|
||||
throw new Error("cannot be added"); |
||||
}, |
||||
|
||||
mounted: function () { |
||||
var self = this; |
||||
var width = this.left.element.outerWidth(), |
||||
height = this.left.element.outerHeight(); |
||||
this.left.element.width(width).height(height).css("float", "none"); |
||||
BI.remove(this._children, function (i, wi) { |
||||
if (wi === self.container) { |
||||
delete self._children[i]; |
||||
} |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.center_adapt", |
||||
element: this, |
||||
items: [this.left] |
||||
}); |
||||
}, |
||||
|
||||
stroke: function (items) { |
||||
var self = this, o = this.options; |
||||
this.left = BI.createWidget({ |
||||
type: "bi.vertical", |
||||
items: items, |
||||
hgap: o.hgap, |
||||
vgap: o.vgap, |
||||
tgap: o.tgap, |
||||
bgap: o.bgap, |
||||
lgap: o.lgap, |
||||
rgap: o.rgap |
||||
}); |
||||
|
||||
this.container = BI.createWidget({ |
||||
type: "bi.left", |
||||
element: this, |
||||
items: [this.left] |
||||
}); |
||||
|
||||
}, |
||||
|
||||
populate: function (items) { |
||||
BI.FloatCenterAdaptLayout.superclass.populate.apply(this, arguments); |
||||
this._mount(); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.float_center_adapt", BI.FloatCenterAdaptLayout); |
@ -1,112 +0,0 @@
|
||||
/** |
||||
* Created by Urthur on 2017/7/14. |
||||
*/ |
||||
BI.DateTimeSelect = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.DateTimeSelect.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-date-time-select bi-border", |
||||
max: 23, |
||||
min: 0 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.DateTimeSelect.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.editor = BI.createWidget({ |
||||
type: "bi.sign_editor", |
||||
value: this._alertInEditorValue(o.min), |
||||
allowBlank: false, |
||||
errorText: function (v) { |
||||
if(BI.isNumeric(v)) { |
||||
return BI.i18nText("BI-Please_Input_Natural_Number"); |
||||
} |
||||
return BI.i18nText("BI-Numerical_Interval_Input_Data"); |
||||
}, |
||||
validationChecker: function (v) { |
||||
return BI.isNaturalNumber(v); |
||||
} |
||||
}); |
||||
this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { |
||||
self._finetuning(0); |
||||
self.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM); |
||||
}); |
||||
this.topBtn = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom" |
||||
}); |
||||
this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self._finetuning(1); |
||||
self.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM); |
||||
}); |
||||
this.bottomBtn = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
cls: "column-next-page-h-font bottom-button bi-border-left" |
||||
}); |
||||
this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self._finetuning(-1); |
||||
self.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM); |
||||
}); |
||||
this._finetuning(0); |
||||
BI.createWidget({ |
||||
type: "bi.htape", |
||||
element: this, |
||||
items: [this.editor, { |
||||
el: { |
||||
type: "bi.grid", |
||||
columns: 1, |
||||
rows: 2, |
||||
items: [{ |
||||
column: 0, |
||||
row: 0, |
||||
el: this.topBtn |
||||
}, { |
||||
column: 0, |
||||
row: 1, |
||||
el: this.bottomBtn |
||||
}] |
||||
}, |
||||
width: 30 |
||||
}] |
||||
}); |
||||
}, |
||||
|
||||
_alertOutEditorValue: function (v) { |
||||
if (v > this.options.max) { |
||||
v = this.options.min; |
||||
} |
||||
if (v < this.options.min) { |
||||
v = this.options.max; |
||||
} |
||||
return BI.parseInt(v); |
||||
}, |
||||
|
||||
_alertInEditorValue: function (v) { |
||||
if (v > this.options.max) { |
||||
v = this.options.min; |
||||
} |
||||
if (v < this.options.min) { |
||||
v = this.options.max; |
||||
} |
||||
v = v < 10 ? "0" + v : v; |
||||
return v; |
||||
}, |
||||
|
||||
_finetuning: function (add) { |
||||
var v = BI.parseInt(this._alertOutEditorValue(this.editor.getValue())); |
||||
this.editor.setValue(this._alertInEditorValue(v + add)); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var v = this.editor.getValue(); |
||||
return this._alertOutEditorValue(v); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.editor.setValue(this._alertInEditorValue(v)); |
||||
this._finetuning(0); |
||||
} |
||||
|
||||
}); |
||||
BI.DateTimeSelect.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.shortcut("bi.date_time_select", BI.DateTimeSelect); |
Loading…
Reference in new issue