Browse Source
* commit 'edb05cfc6dfc7d6ec09f62d67fe18ed4a6e02287': BI-52027 fix: 横纵滚动条交界处不需要颜色 update BI-52072 test: 若干控件单测绿化es6
windy
5 years ago
18 changed files with 365 additions and 505 deletions
@ -1,31 +0,0 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/12 |
||||
*/ |
||||
|
||||
|
||||
describe("month", function () { |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("setValue", function () { |
||||
var combo = BI.Test.createWidget({ |
||||
type: "bi.month_combo", |
||||
}); |
||||
combo.setValue(11); |
||||
expect(combo.getValue()).to.equal(11); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("getValue", function () { |
||||
var combo = BI.Test.createWidget({ |
||||
type: "bi.month_combo", |
||||
value: 1 |
||||
}); |
||||
expect(combo.getValue()).to.equal(1); |
||||
}); |
||||
}); |
@ -1,92 +0,0 @@
|
||||
/** |
||||
* 月份下拉框 |
||||
* |
||||
* Created by GUY on 2015/8/28. |
||||
* @class BI.MonthCombo |
||||
* @extends BI.Trigger |
||||
*/ |
||||
BI.MonthCombo = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-month-combo", |
||||
behaviors: {}, |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.MonthCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
|
||||
this.trigger = BI.createWidget({ |
||||
type: "bi.month_trigger", |
||||
value: o.value |
||||
}); |
||||
|
||||
this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) { |
||||
if (self.combo.isViewVisible()) { |
||||
return; |
||||
} |
||||
if (this.getKey() && this.getKey() !== self.storeValue) { |
||||
self.setValue(this.getValue()); |
||||
} else if (!this.getKey()) { |
||||
self.setValue(); |
||||
} |
||||
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); |
||||
}); |
||||
this.trigger.on(BI.MonthTrigger.EVENT_FOCUS, function () { |
||||
self.storeValue = this.getKey(); |
||||
}); |
||||
this.trigger.on(BI.MonthTrigger.EVENT_START, function () { |
||||
self.combo.hideView(); |
||||
}); |
||||
this.trigger.on(BI.MonthTrigger.EVENT_STOP, function () { |
||||
if (!self.combo.isViewVisible()) { |
||||
self.combo.showView(); |
||||
} |
||||
}); |
||||
|
||||
this.popup = BI.createWidget({ |
||||
type: "bi.month_popup", |
||||
behaviors: o.behaviors, |
||||
value: o.value |
||||
}); |
||||
this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { |
||||
self.setValue(self.popup.getValue()); |
||||
self.combo.hideView(); |
||||
self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); |
||||
}); |
||||
|
||||
this.combo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
container: o.container, |
||||
element: this, |
||||
isNeedAdjustHeight: false, |
||||
isNeedAdjustWidth: false, |
||||
el: this.trigger, |
||||
popup: { |
||||
minWidth: 85, |
||||
el: this.popup |
||||
} |
||||
}); |
||||
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { |
||||
self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW); |
||||
}); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.trigger.setValue(v); |
||||
this.popup.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
if (BI.isNull(this.popup)) { |
||||
return this.options.value || ""; |
||||
} else { |
||||
return this.popup.getValue() || ""; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
||||
BI.shortcut("bi.month_combo", BI.MonthCombo); |
@ -1,110 +0,0 @@
|
||||
/** |
||||
* 月份trigger |
||||
* |
||||
* Created by GUY on 2015/8/21. |
||||
* @class BI.MonthTrigger |
||||
* @extends BI.Trigger |
||||
*/ |
||||
BI.MonthTrigger = BI.inherit(BI.Trigger, { |
||||
_const: { |
||||
hgap: 4, |
||||
vgap: 2 |
||||
}, |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.MonthTrigger.superclass._defaultConfig.apply(this, arguments), { |
||||
extraCls: "bi-month-trigger bi-border", |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.MonthTrigger.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options, c = this._const; |
||||
this.editor = BI.createWidget({ |
||||
type: "bi.sign_editor", |
||||
height: o.height, |
||||
validationChecker: function (v) { |
||||
return v === "" || (BI.isPositiveInteger(v) && v >= 1 && v <= 12); |
||||
}, |
||||
quitChecker: function (v) { |
||||
return false; |
||||
}, |
||||
hgap: c.hgap, |
||||
vgap: c.vgap, |
||||
allowBlank: true, |
||||
errorText: BI.i18nText("BI-Month_Trigger_Error_Text") |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { |
||||
self.fireEvent(BI.MonthTrigger.EVENT_FOCUS); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.MonthTrigger.EVENT_CHANGE); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { |
||||
var value = self.editor.getValue(); |
||||
if (BI.isNotNull(value)) { |
||||
self.editor.setValue(value); |
||||
self.editor.setTitle(value); |
||||
} |
||||
self.fireEvent(BI.MonthTrigger.EVENT_CONFIRM); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_SPACE, function () { |
||||
if (self.editor.isValid()) { |
||||
self.editor.blur(); |
||||
} |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_START, function () { |
||||
self.fireEvent(BI.MonthTrigger.EVENT_START); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_STOP, function () { |
||||
self.fireEvent(BI.MonthTrigger.EVENT_STOP); |
||||
}); |
||||
BI.createWidget({ |
||||
element: this, |
||||
type: "bi.htape", |
||||
items: [ |
||||
{ |
||||
el: this.editor |
||||
}, { |
||||
el: { |
||||
type: "bi.text_button", |
||||
text: BI.i18nText("BI-Multi_Date_Month"), |
||||
baseCls: "bi-trigger-month-text", |
||||
width: o.height |
||||
}, |
||||
width: o.height |
||||
}, { |
||||
el: { |
||||
type: "bi.trigger_icon_button", |
||||
width: o.height |
||||
}, |
||||
width: o.height |
||||
} |
||||
] |
||||
}); |
||||
this.setValue(o.value); |
||||
}, |
||||
setValue: function (v) { |
||||
if(BI.isNotNull(v)) { |
||||
this.editor.setState(v + 1); |
||||
this.editor.setValue(v + 1); |
||||
this.editor.setTitle(v + 1); |
||||
return; |
||||
} |
||||
this.editor.setState(""); |
||||
this.editor.setValue(""); |
||||
this.editor.setTitle(""); |
||||
}, |
||||
getKey: function () { |
||||
return this.editor.getValue() | 0; |
||||
}, |
||||
getValue: function () { |
||||
return this.editor.getValue() - 1; |
||||
} |
||||
}); |
||||
BI.MonthTrigger.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.MonthTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.MonthTrigger.EVENT_START = "EVENT_START"; |
||||
BI.MonthTrigger.EVENT_STOP = "EVENT_STOP"; |
||||
BI.MonthTrigger.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.month_trigger", BI.MonthTrigger); |
@ -0,0 +1,62 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
||||
describe("multi_layer_down_list_combo", function () { |
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("defaultValue", function () { |
||||
var downListCombo = BI.Test.createWidget({ |
||||
type: "bi.multi_layer_down_list_combo", |
||||
items: [[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":12},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}],[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":11},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font", children: [{"text":"column 1.1","value":21,"cls":"dot-e-font"}]},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}]] |
||||
}); |
||||
downListCombo.setValue([{value: 12, childValue: 21}]); |
||||
expect(downListCombo.getValue()).to.deep.equal([ { childValue: 21, value: 12 } ]); |
||||
downListCombo.destroy(); |
||||
}); |
||||
|
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("点击父亲选值", function (done) { |
||||
var downListCombo = BI.Test.createWidget({ |
||||
type: "bi.multi_layer_down_list_combo", |
||||
height: 30, |
||||
width: 30, |
||||
items: [[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":12},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}],[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":11},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}], [{"text": "column 1122", value: 32}, {"text": "column 1133", value: 33}]] |
||||
}); |
||||
downListCombo.element.children(".pull-down-font").click(); |
||||
BI.nextTick(function () { |
||||
downListCombo.element.find(".bi-down-list-group:last-child .bi-down-list-item").click(); |
||||
expect(downListCombo.getValue()).to.deep.equal([ { value: 33 } ]); |
||||
done(); |
||||
}); |
||||
}); |
||||
|
||||
|
||||
/** |
||||
* test_author_windy |
||||
*/ |
||||
it("点击儿子选值", function (done) { |
||||
var downListCombo = BI.Test.createWidget({ |
||||
type: "bi.multi_layer_down_list_combo", |
||||
height: 30, |
||||
width: 30, |
||||
items: [[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":12},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}],[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":11},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}]] |
||||
}); |
||||
downListCombo.element.children(".pull-down-font").click(); |
||||
BI.Test.triggerMouseover(downListCombo.element.find(".bi-down-list-group:first-child .bi-down-list-group-item"), function () { |
||||
BI.nextTick(function () { |
||||
downListCombo.element.find(".child-down-list-item:first-child").click(); |
||||
expect(downListCombo.getValue()).to.deep.equal([ { childValue: 21, value: 12 } ]); |
||||
downListCombo.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
}); |
@ -0,0 +1,135 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
||||
|
||||
describe("multilayer_select_tree", function () { |
||||
|
||||
var items = [{id: -1, pId: -2, value: "根目录", text: "根目录"}, |
||||
{id: 1, pId: -1, value: "第一级目录1", text: "第一级目录1"}, |
||||
{id: 11, pId: 1, value: "第二级文件1", text: "第二级文件1"}, |
||||
{id: 12, pId: 1, value: "第二级目录2", text: "第二级目录2"}, |
||||
{id: 121, pId: 12, value: "第三级目录1", text: "第三级目录1"}, |
||||
{id: 122, pId: 12, value: "第三级文件1", text: "第三级文件1"}, |
||||
{id: 1211, pId: 121, value: "第四级目录1", text: "第四级目录1"}, |
||||
{ |
||||
id: 12111, |
||||
pId: 1211, |
||||
value: "第五级文件1", |
||||
text: "第五级文件111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" |
||||
}, |
||||
{id: 2, pId: -1, value: "第一级目录2", text: "第一级目录2"}, |
||||
{id: 21, pId: 2, value: "第二级目录3", text: "第二级目录3"}, |
||||
{id: 22, pId: 2, value: "第二级文件2", text: "第二级文件2"}, |
||||
{id: 211, pId: 21, value: "第三级目录2", text: "第三级目录2"}, |
||||
{id: 212, pId: 21, value: "第三级文件2", text: "第三级文件2"}, |
||||
{id: 2111, pId: 211, value: "第四级文件1", text: "第四级文件1"}]; |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("defaultValue_allowEdit", function () { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_select_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
items: BI.deepClone(items), |
||||
value: "第一级目录2" |
||||
}); |
||||
expect(tree.getValue()).to.equal("第一级目录2"); |
||||
tree.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("defaultValue_not_allowEdit", function () { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_select_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
items: BI.deepClone(items), |
||||
value: "第一级目录2" |
||||
}); |
||||
expect(tree.getValue()).to.equal("第一级目录2"); |
||||
tree.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("点选选值", function (done) { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_select_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
items: BI.deepClone(items), |
||||
value: "第一级目录2" |
||||
}); |
||||
tree.element.find(".bi-multi-layer-select-tree-trigger").click(); |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-select-tree-plus-group-node").click(); |
||||
expect(tree.getValue()[0]).to.equal("根目录"); |
||||
tree.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("搜索选值", function (done) { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_select_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
items: BI.deepClone(items) |
||||
}); |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-multi-layer-select-tree-trigger .tip-text-style").click(); |
||||
// 这边为啥要加呢,因为input的setValue中有nextTick
|
||||
BI.nextTick(function () { |
||||
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-select-tree-trigger .bi-input"), "2", 50, function () { |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-select-tree-mid-plus-group-node").click(); |
||||
expect(tree.getValue()[0]).to.equal("第一级目录2"); |
||||
tree.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("新增值", function (done) { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_select_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
allowInsertValue: true, |
||||
items: BI.deepClone(items) |
||||
}); |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-multi-layer-select-tree-trigger .tip-text-style").click(); |
||||
// 这边为啥要加呢,因为input的setValue中有nextTick
|
||||
BI.nextTick(function () { |
||||
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-select-tree-trigger .bi-input"), "z", 50, function () { |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-text-button:contains(+点击新增\"z\")").click(); |
||||
expect(tree.getValue()[0]).to.equal("z"); |
||||
tree.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
@ -0,0 +1,133 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
||||
describe("multilayer_single_tree", function () { |
||||
|
||||
var items = [{id: -1, pId: -2, value: "根目录", text: "根目录", open: true}, |
||||
{id: 1, pId: -1, value: "第一级目录1", text: "第一级目录1", open: true}, |
||||
{id: 11, pId: 1, value: "第二级文件1", text: "第二级文件1"}, |
||||
{id: 12, pId: 1, value: "第二级目录2", text: "第二级目录2", open: true}, |
||||
{id: 121, pId: 12, value: "第三级目录1", text: "第三级目录1", open: true}, |
||||
{id: 122, pId: 12, value: "第三级文件1", text: "第三级文件1"}, |
||||
{id: 1211, pId: 121, value: "第四级目录1", text: "第四级目录1", open: true}, |
||||
{ |
||||
id: 12111, |
||||
pId: 1211, |
||||
value: "第五级文件1", |
||||
text: "第五级文件111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" |
||||
}, |
||||
{id: 2, pId: -1, value: "第一级目录2", text: "第一级目录2", open: true}, |
||||
{id: 21, pId: 2, value: "第二级目录3", text: "第二级目录3", open: true}, |
||||
{id: 22, pId: 2, value: "第二级文件2", text: "第二级文件2"}, |
||||
{id: 211, pId: 21, value: "第三级目录2", text: "第三级目录2", open: true}, |
||||
{id: 212, pId: 21, value: "第三级文件2", text: "第三级文件2"}, |
||||
{id: 2111, pId: 211, value: "第四级文件1", text: "第四级文件1"}]; |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("defaultValue_allowEdit", function () { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_single_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
items: BI.deepClone(items), |
||||
value: "第二级文件1" |
||||
}); |
||||
expect(tree.getValue()).to.equal("第二级文件1"); |
||||
tree.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("defaultValue_not_allowEdit", function () { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_single_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
items: BI.deepClone(items), |
||||
value: "第二级文件1" |
||||
}); |
||||
expect(tree.getValue()).to.equal("第二级文件1"); |
||||
tree.destroy(); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("点选选值", function (done) { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_single_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
items: BI.deepClone(items) |
||||
}); |
||||
tree.element.find(".bi-multi-layer-single-tree-trigger").click(); |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-multilayer-single-tree-mid-tree-leaf-item").click(); |
||||
expect(tree.getValue()[0]).to.equal("第二级文件1"); |
||||
tree.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("搜索选值", function (done) { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_single_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
items: BI.deepClone(items) |
||||
}); |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-multi-layer-single-tree-trigger .tip-text-style").click(); |
||||
// 这边为啥要加呢,因为input的setValue中有nextTick
|
||||
BI.nextTick(function () { |
||||
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-single-tree-trigger .bi-input"), "2", 50, function () { |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-multilayer-single-tree-mid-tree-leaf-item").click(); |
||||
expect(tree.getValue()[0]).to.equal("第二级文件1"); |
||||
tree.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
|
||||
/** |
||||
* test_author_windy |
||||
**/ |
||||
it("新增值", function (done) { |
||||
var tree = BI.Test.createWidget({ |
||||
type: "bi.multilayer_single_tree_combo", |
||||
width: 300, |
||||
height: 24, |
||||
allowEdit: true, |
||||
allowInsertValue: true, |
||||
items: BI.deepClone(items) |
||||
}); |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-multi-layer-single-tree-trigger .tip-text-style").click(); |
||||
// 这边为啥要加呢,因为input的setValue中有nextTick
|
||||
BI.nextTick(function () { |
||||
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-single-tree-trigger .bi-input"), "z", 50, function () { |
||||
BI.nextTick(function () { |
||||
tree.element.find(".bi-text-button:contains(+点击新增\"z\")").click(); |
||||
expect(tree.getValue()[0]).to.equal("z"); |
||||
tree.destroy(); |
||||
done(); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
@ -0,0 +1,5 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
@ -0,0 +1,5 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
@ -0,0 +1,5 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
@ -0,0 +1,5 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2019/9/18 |
||||
*/ |
@ -1,92 +0,0 @@
|
||||
/** |
||||
* 季度下拉框 |
||||
* |
||||
* Created by GUY on 2015/8/28. |
||||
* @class BI.QuarterCombo |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.QuarterCombo = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-quarter-combo", |
||||
behaviors: {}, |
||||
height: 25 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.QuarterCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.storeValue = ""; |
||||
this.trigger = BI.createWidget({ |
||||
type: "bi.quarter_trigger", |
||||
value: o.value |
||||
}); |
||||
|
||||
this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () { |
||||
self.storeValue = this.getKey(); |
||||
}); |
||||
this.trigger.on(BI.QuarterTrigger.EVENT_START, function () { |
||||
self.combo.isViewVisible() && self.combo.hideView(); |
||||
}); |
||||
this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function () { |
||||
if (!self.combo.isViewVisible()) { |
||||
self.combo.showView(); |
||||
} |
||||
}); |
||||
this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () { |
||||
if (self.combo.isViewVisible()) { |
||||
return; |
||||
} |
||||
if (this.getKey() && this.getKey() !== self.storeValue) { |
||||
self.setValue(this.getKey()); |
||||
} else if (!this.getKey()) { |
||||
self.setValue(); |
||||
} |
||||
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM); |
||||
}); |
||||
this.popup = BI.createWidget({ |
||||
type: "bi.quarter_popup", |
||||
behaviors: o.behaviors, |
||||
value: o.value |
||||
}); |
||||
|
||||
this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () { |
||||
self.setValue(self.popup.getValue()); |
||||
self.combo.hideView(); |
||||
self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM); |
||||
}); |
||||
|
||||
this.combo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
container: o.container, |
||||
element: this, |
||||
isNeedAdjustHeight: false, |
||||
isNeedAdjustWidth: false, |
||||
el: this.trigger, |
||||
popup: { |
||||
minWidth: 85, |
||||
el: this.popup |
||||
} |
||||
}); |
||||
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { |
||||
self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW); |
||||
}); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.trigger.setValue(v); |
||||
this.popup.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
if (BI.isNull(this.popup)) { |
||||
return this.options.value || ""; |
||||
} else { |
||||
return this.popup.getValue() || ""; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
||||
BI.shortcut("bi.quarter_combo", BI.QuarterCombo); |
@ -1,74 +0,0 @@
|
||||
/** |
||||
* 季度展示面板 |
||||
* |
||||
* Created by GUY on 2015/9/2. |
||||
* @class BI.QuarterPopup |
||||
* @extends BI.Trigger |
||||
*/ |
||||
BI.QuarterPopup = BI.inherit(BI.Widget, { |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-quarter-popup", |
||||
behaviors: {} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.QuarterPopup.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
|
||||
var items = [{ |
||||
text: BI.Date._QN[1], |
||||
value: 1 |
||||
}, { |
||||
text: BI.Date._QN[2], |
||||
value: 2 |
||||
}, { |
||||
text: BI.Date._QN[3], |
||||
value: 3 |
||||
}, { |
||||
text: BI.Date._QN[4], |
||||
value: 4 |
||||
}]; |
||||
items = BI.map(items, function (j, item) { |
||||
return BI.extend(item, { |
||||
type: "bi.text_item", |
||||
cls: "bi-list-item-active", |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
once: false, |
||||
forceSelected: true, |
||||
height: 25 |
||||
}); |
||||
}); |
||||
|
||||
this.quarter = BI.createWidget({ |
||||
type: "bi.button_group", |
||||
element: this, |
||||
behaviors: o.behaviors, |
||||
items: BI.createItems(items, {}), |
||||
layouts: [{ |
||||
type: "bi.vertical" |
||||
}], |
||||
value: o.value |
||||
}); |
||||
|
||||
this.quarter.on(BI.Controller.EVENT_CHANGE, function (type) { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
if (type === BI.Events.CLICK) { |
||||
self.fireEvent(BI.MonthPopup.EVENT_CHANGE); |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.quarter.getValue()[0]; |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.quarter.setValue([v]); |
||||
} |
||||
}); |
||||
BI.QuarterPopup.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.quarter_popup", BI.QuarterPopup); |
@ -1,106 +0,0 @@
|
||||
/** |
||||
* 季度trigger |
||||
* |
||||
* Created by GUY on 2015/8/21. |
||||
* @class BI.QuarterTrigger |
||||
* @extends BI.Trigger |
||||
*/ |
||||
BI.QuarterTrigger = BI.inherit(BI.Trigger, { |
||||
_const: { |
||||
hgap: 4, |
||||
vgap: 2, |
||||
textWidth: 40 |
||||
}, |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.QuarterTrigger.superclass._defaultConfig.apply(this, arguments), { |
||||
extraCls: "bi-quarter-trigger bi-border", |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.QuarterTrigger.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options, c = this._const; |
||||
this.editor = BI.createWidget({ |
||||
type: "bi.sign_editor", |
||||
height: o.height, |
||||
validationChecker: function (v) { |
||||
return v === "" || (BI.isPositiveInteger(v) && v >= 1 && v <= 4); |
||||
}, |
||||
quitChecker: function (v) { |
||||
return false; |
||||
}, |
||||
hgap: c.hgap, |
||||
vgap: c.vgap, |
||||
allowBlank: true, |
||||
errorText: BI.i18nText("BI-Quarter_Trigger_Error_Text") |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { |
||||
self.fireEvent(BI.QuarterTrigger.EVENT_FOCUS); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.QuarterTrigger.EVENT_CHANGE); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { |
||||
var value = self.editor.getValue(); |
||||
if (BI.isNotNull(value)) { |
||||
self.editor.setValue(value); |
||||
self.editor.setTitle(value); |
||||
} |
||||
self.fireEvent(BI.QuarterTrigger.EVENT_CONFIRM); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_SPACE, function () { |
||||
if (self.editor.isValid()) { |
||||
self.editor.blur(); |
||||
} |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_START, function () { |
||||
self.fireEvent(BI.QuarterTrigger.EVENT_START); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_STOP, function () { |
||||
self.fireEvent(BI.QuarterTrigger.EVENT_STOP); |
||||
}); |
||||
|
||||
BI.createWidget({ |
||||
element: this, |
||||
type: "bi.htape", |
||||
items: [ |
||||
{ |
||||
el: this.editor |
||||
}, { |
||||
el: { |
||||
type: "bi.text_button", |
||||
baseCls: "bi-trigger-quarter-text", |
||||
text: BI.i18nText("BI-Multi_Date_Quarter"), |
||||
width: c.textWidth |
||||
}, |
||||
width: c.textWidth |
||||
}, { |
||||
el: { |
||||
type: "bi.trigger_icon_button", |
||||
width: o.height |
||||
}, |
||||
width: o.height |
||||
} |
||||
] |
||||
}); |
||||
this.setValue(o.value); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
v = v || ""; |
||||
this.editor.setState(v); |
||||
this.editor.setValue(v); |
||||
this.editor.setTitle(v); |
||||
}, |
||||
|
||||
getKey: function () { |
||||
return this.editor.getValue(); |
||||
} |
||||
}); |
||||
BI.QuarterTrigger.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.QuarterTrigger.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.QuarterTrigger.EVENT_START = "EVENT_START"; |
||||
BI.QuarterTrigger.EVENT_STOP = "EVENT_STOP"; |
||||
BI.QuarterTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.shortcut("bi.quarter_trigger", BI.QuarterTrigger); |
Loading…
Reference in new issue