From fa0e94dae997f1d72f6b1a172e870c7068aa5c02 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 3 Sep 2019 10:45:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BC=96=E5=86=99=E5=8D=95=E6=B5=8B?= =?UTF-8?q?=E5=8F=91=E7=8E=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/2.0/fineui.ie.js | 16 +- dist/2.0/fineui.js | 16 +- dist/bundle.ie.js | 16 +- dist/bundle.js | 16 +- dist/fineui.ie.js | 16 +- dist/fineui.js | 16 +- dist/fineui_without_jquery_polyfill.js | 16 +- dist/widget.js | 16 +- .../__test__/datetimepane.test.js | 152 ++++++++++++++++++ .../dynamicdatetime.timeselect.js | 4 +- src/widget/numbereditor/number.editor.js | 12 +- 11 files changed, 224 insertions(+), 72 deletions(-) create mode 100644 src/widget/datetimepane/__test__/datetimepane.test.js diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 80928cb877..eb9b6db9e4 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -66173,8 +66173,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77562,11 +77562,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77576,8 +77576,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77587,8 +77587,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 9bc68ae6cb..44d678c8e2 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -66577,8 +66577,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77966,11 +77966,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77980,8 +77980,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77991,8 +77991,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 80928cb877..eb9b6db9e4 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -66173,8 +66173,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77562,11 +77562,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77576,8 +77576,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77587,8 +77587,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/bundle.js b/dist/bundle.js index 9bc68ae6cb..44d678c8e2 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -66577,8 +66577,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77966,11 +77966,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77980,8 +77980,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77991,8 +77991,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index efc058a9d8..5a3beb77eb 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -66418,8 +66418,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -77807,11 +77807,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -77821,8 +77821,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -77832,8 +77832,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui.js b/dist/fineui.js index da2d9cb018..0e2f4b3318 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -66822,8 +66822,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -78211,11 +78211,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -78225,8 +78225,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -78236,8 +78236,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 61e8bb8e18..9e518b7512 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -49121,8 +49121,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -60510,11 +60510,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -60524,8 +60524,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -60535,8 +60535,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/dist/widget.js b/dist/widget.js index 12b2ce0187..17c6813ece 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4232,8 +4232,8 @@ BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup);BI.DynamicDat } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], @@ -15621,11 +15621,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -15635,8 +15635,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -15646,8 +15646,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape", diff --git a/src/widget/datetimepane/__test__/datetimepane.test.js b/src/widget/datetimepane/__test__/datetimepane.test.js new file mode 100644 index 0000000000..5faf7c84b1 --- /dev/null +++ b/src/widget/datetimepane/__test__/datetimepane.test.js @@ -0,0 +1,152 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2019/9/3 + */ +/** + * @author windy + * @version 2.0 + * Created by windy on 2019/9/2 + */ + +describe("DateTimePane", function () { + + /** + * test_author_windy + */ + it("defaultValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + value: { + type: 1, + value: { + year: 2017, + month: 12, + day: 11 + } + }, + }); + expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); + expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); + expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("setStaticValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + }); + datePane.setValue({ + type: 1, + value: { + year: 2017, + month: 12, + day: 11 + } + }); + expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); + expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); + expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("setDynamicValue", function () { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + }); + datePane.setValue({ + type: 2, + value: { + year: -1, + month: 1, + quarter: -1, + week: 1, + day: 1 + } + }); + expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); + + datePane.setValue({ + type: 2, + value: { + workDay: 1 + } + }); + expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); + datePane.destroy(); + }); + + /** + * test_author_windy + */ + it("getStaticValue", function (done) { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + value: { + type: 1, + value: { + year: 2019, + month: 3, + day: 30 + } + } + }); + BI.nextTick(function () { + datePane.element.find(".bi-month-combo .bi-date-triangle-trigger").click(); + datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click(); + BI.nextTick(function () { + datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click(); + datePane.element.find(".bi-date-time-select .bi-number-editor .top-button").click(); + expect(datePane.getValue()).to.deep.equal({ + type: 1, + value: { + year: 2019, + month: 2, + day: 27, + hour: 0, + minute: 0, + second: 0 + } + }); + datePane.destroy(); + done(); + }) + }); + }); + + /** + * test_author_windy + */ + it("getDynamicValue", function (done) { + var datePane = BI.Test.createWidget({ + type: "bi.dynamic_date_time_pane", + value: { + type: 2, + value: {} + } + }); + BI.nextTick(function () { + // 先点到静态时间再到动态时间 + datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(0).click(); + datePane.element.find(".bi-linear-segment .bi-line-segment-button").get(1).click(); + BI.nextTick(function () { + datePane.element.find(".bi-multi-select-item.active").click(); + datePane.element.find(".bi-multi-select-item").click(); + expect(datePane.getValue()).to.deep.equal({ + type: 2, + value: { + workDay: -0 + } + }); + datePane.destroy(); + done(); + }) + }); + }); +}); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js index 84f54abcfb..a0959db2e3 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.timeselect.js @@ -35,8 +35,8 @@ BI.DynamicDateTimeSelect = BI.inherit(BI.Widget, { } }, { eventName: BI.SignEditor.EVENT_CHANGE, - action: function () { - var value = self._autoSwitch(this.getLastChangedValue(), BI.DynamicDateTimeSelect.HOUR); + action: function (v) { + var value = self._autoSwitch(v, BI.DynamicDateTimeSelect.HOUR); this.setValue(value); } }], diff --git a/src/widget/numbereditor/number.editor.js b/src/widget/numbereditor/number.editor.js index fd8f4171f7..8d05191789 100644 --- a/src/widget/numbereditor/number.editor.js +++ b/src/widget/numbereditor/number.editor.js @@ -31,11 +31,11 @@ BI.NumberEditor = BI.inherit(BI.Widget, { errorText: o.errorText }); this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, self.getLastChangedValue()); }); this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { o.value = BI.parseFloat(this.getValue()); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, self.getLastChangedValue()); }); this.topBtn = BI.createWidget({ type: "bi.icon_button", @@ -45,8 +45,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); this.bottomBtn = BI.createWidget({ type: "bi.icon_button", @@ -56,8 +56,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, { }); this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE, o.value); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM, o.value); }); BI.createWidget({ type: "bi.htape",