From 6225cb772796dce52746204481ee8e64a0c303c2 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 21 Mar 2018 14:52:19 +0800 Subject: [PATCH] =?UTF-8?q?BI-17023=20=E6=8E=A7=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bundle.js | 156 ++++++++++++++---- dist/case.js | 104 +++++++++++- dist/widget.js | 52 +++--- .../linearsegment/button.linear.segment.js | 54 ++++++ src/case/linearsegment/linear.segment.js | 50 ++++++ src/widget/dynamic/datepane/datepane.js | 9 +- src/widget/dynamic/year/popup.year.js | 10 +- .../dynamic/yearmonth/popup.yearmonth.js | 10 +- .../dynamic/yearquarter/popup.yearquarter.js | 10 +- src/widget/dynamicdate/dynamicdate.popup.js | 11 +- src/widget/multidate/multidate.popup.js | 2 +- 11 files changed, 370 insertions(+), 98 deletions(-) create mode 100644 src/case/linearsegment/button.linear.segment.js create mode 100644 src/case/linearsegment/linear.segment.js diff --git a/dist/bundle.js b/dist/bundle.js index 0ec53c63c..19fdac22c 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -80551,7 +80551,109 @@ BI.Panel = BI.inherit(BI.Widget, { }); BI.Panel.EVENT_CHANGE = "Panel.EVENT_CHANGE"; -BI.shortcut("bi.panel", BI.Panel);/** +BI.shortcut("bi.panel", BI.Panel);BI.LinearSegmentButton = BI.inherit(BI.BasicButton, { + + props: { + extraCls: "bi-line-segment-button bi-list-item-effect", + once: true, + readonly: true, + hgap: 10, + height: 25 + }, + + render: function () { + var self = this, o = this.options; + + return [{ + type: "bi.label", + text: o.text, + height: o.height, + value: o.value, + hgap: o.hgap, + ref: function () { + self.text = this; + } + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.layout", + cls: "line-segment-button-line", + height: 3, + ref: function () { + self.line = this; + } + }, + left: 0, + right: 0, + bottom: 0 + }] + }]; + }, + + setSelected: function (v) { + BI.LinearSegmentButton.superclass.setSelected.apply(this, arguments); + if (v) { + this.line.element.addClass("bi-high-light-background"); + } else { + this.line.element.removeClass("bi-high-light-background"); + } + }, + + setText: function (text) { + this.text.setText(text); + } +}); +BI.shortcut("bi.linear_segment_button", BI.LinearSegmentButton);BI.LinearSegment = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-linear-segment bi-border-bottom", + items: [], + height: 29 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.linear_segment_button", + height: o.height - 1 + }), + layout: [{ + type: "bi.center" + }], + listeners: [{ + eventName: "__EVENT_CHANGE__", + action: function () { + self.fireEvent("__EVENT_CHANGE__", arguments); + } + }, { + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }], + ref: function () { + self.buttonGroup = this; + } + }; + }, + + setValue: function (v) { + this.buttonGroup.setValue(v); + }, + + setEnabledValue: function (v) { + this.buttonGroup.setEnabledValue(v); + }, + + + getValue: function () { + return this.buttonGroup.getValue(); + } +}); +BI.shortcut("bi.linear_segment", BI.LinearSegment);/** * 选择列表 * * Created by GUY on 2015/11/1. @@ -89230,7 +89332,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan type: "bi.vtape", items: [{ el: { - type: "bi.button_group", + type: "bi.linear_segment", + cls: "bi-border-bottom", height: 30, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), @@ -89239,12 +89342,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicDatePane.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" + textAlign: "center" }), - layouts: [{ - type: "bi.center" - }], listeners: [{ eventName: BI.ButtonGroup.EVENT_CHANGE, action: function () { @@ -89799,6 +89898,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -89807,12 +89908,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -90454,6 +90551,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -90462,12 +90561,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -91135,6 +91230,8 @@ BI.extend(BI.DynamicYearQuarterCombo, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -91143,12 +91240,8 @@ BI.extend(BI.DynamicYearQuarterCombo, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearQuarterCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -92237,7 +92330,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat self.dateTab = this; }, tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), @@ -92246,12 +92340,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicDateCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -95273,7 +95363,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { this.dateTab = BI.createWidget({ type: "bi.tab", tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), diff --git a/dist/case.js b/dist/case.js index a8dc0a7c5..5fdf73748 100644 --- a/dist/case.js +++ b/dist/case.js @@ -8384,7 +8384,109 @@ BI.Panel = BI.inherit(BI.Widget, { }); BI.Panel.EVENT_CHANGE = "Panel.EVENT_CHANGE"; -BI.shortcut("bi.panel", BI.Panel);/** +BI.shortcut("bi.panel", BI.Panel);BI.LinearSegmentButton = BI.inherit(BI.BasicButton, { + + props: { + extraCls: "bi-line-segment-button bi-list-item-effect", + once: true, + readonly: true, + hgap: 10, + height: 25 + }, + + render: function () { + var self = this, o = this.options; + + return [{ + type: "bi.label", + text: o.text, + height: o.height, + value: o.value, + hgap: o.hgap, + ref: function () { + self.text = this; + } + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.layout", + cls: "line-segment-button-line", + height: 3, + ref: function () { + self.line = this; + } + }, + left: 0, + right: 0, + bottom: 0 + }] + }]; + }, + + setSelected: function (v) { + BI.LinearSegmentButton.superclass.setSelected.apply(this, arguments); + if (v) { + this.line.element.addClass("bi-high-light-background"); + } else { + this.line.element.removeClass("bi-high-light-background"); + } + }, + + setText: function (text) { + this.text.setText(text); + } +}); +BI.shortcut("bi.linear_segment_button", BI.LinearSegmentButton);BI.LinearSegment = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-linear-segment bi-border-bottom", + items: [], + height: 29 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.linear_segment_button", + height: o.height - 1 + }), + layout: [{ + type: "bi.center" + }], + listeners: [{ + eventName: "__EVENT_CHANGE__", + action: function () { + self.fireEvent("__EVENT_CHANGE__", arguments); + } + }, { + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }], + ref: function () { + self.buttonGroup = this; + } + }; + }, + + setValue: function (v) { + this.buttonGroup.setValue(v); + }, + + setEnabledValue: function (v) { + this.buttonGroup.setEnabledValue(v); + }, + + + getValue: function () { + return this.buttonGroup.getValue(); + } +}); +BI.shortcut("bi.linear_segment", BI.LinearSegment);/** * 选择列表 * * Created by GUY on 2015/11/1. diff --git a/dist/widget.js b/dist/widget.js index 6488ce545..691c5edbf 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -2661,7 +2661,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan type: "bi.vtape", items: [{ el: { - type: "bi.button_group", + type: "bi.linear_segment", + cls: "bi-border-bottom", height: 30, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), @@ -2670,12 +2671,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicDatePane.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" + textAlign: "center" }), - layouts: [{ - type: "bi.center" - }], listeners: [{ eventName: BI.ButtonGroup.EVENT_CHANGE, action: function () { @@ -3230,6 +3227,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -3238,12 +3237,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -3885,6 +3880,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -3893,12 +3890,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -4566,6 +4559,8 @@ BI.extend(BI.DynamicYearQuarterCombo, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -4574,12 +4569,8 @@ BI.extend(BI.DynamicYearQuarterCombo, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearQuarterCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -5668,7 +5659,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat self.dateTab = this; }, tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), @@ -5677,12 +5669,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicDateCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { @@ -8704,7 +8692,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { this.dateTab = BI.createWidget({ type: "bi.tab", tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), diff --git a/src/case/linearsegment/button.linear.segment.js b/src/case/linearsegment/button.linear.segment.js new file mode 100644 index 000000000..90ecb579a --- /dev/null +++ b/src/case/linearsegment/button.linear.segment.js @@ -0,0 +1,54 @@ +BI.LinearSegmentButton = BI.inherit(BI.BasicButton, { + + props: { + extraCls: "bi-line-segment-button bi-list-item-effect", + once: true, + readonly: true, + hgap: 10, + height: 25 + }, + + render: function () { + var self = this, o = this.options; + + return [{ + type: "bi.label", + text: o.text, + height: o.height, + value: o.value, + hgap: o.hgap, + ref: function () { + self.text = this; + } + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.layout", + cls: "line-segment-button-line", + height: 3, + ref: function () { + self.line = this; + } + }, + left: 0, + right: 0, + bottom: 0 + }] + }]; + }, + + setSelected: function (v) { + BI.LinearSegmentButton.superclass.setSelected.apply(this, arguments); + if (v) { + this.line.element.addClass("bi-high-light-background"); + } else { + this.line.element.removeClass("bi-high-light-background"); + } + }, + + setText: function (text) { + this.text.setText(text); + } +}); +BI.shortcut("bi.linear_segment_button", BI.LinearSegmentButton); \ No newline at end of file diff --git a/src/case/linearsegment/linear.segment.js b/src/case/linearsegment/linear.segment.js new file mode 100644 index 000000000..0374d9690 --- /dev/null +++ b/src/case/linearsegment/linear.segment.js @@ -0,0 +1,50 @@ +BI.LinearSegment = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-linear-segment bi-border-bottom", + items: [], + height: 29 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.linear_segment_button", + height: o.height - 1 + }), + layout: [{ + type: "bi.center" + }], + listeners: [{ + eventName: "__EVENT_CHANGE__", + action: function () { + self.fireEvent("__EVENT_CHANGE__", arguments); + } + }, { + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }], + ref: function () { + self.buttonGroup = this; + } + }; + }, + + setValue: function (v) { + this.buttonGroup.setValue(v); + }, + + setEnabledValue: function (v) { + this.buttonGroup.setEnabledValue(v); + }, + + + getValue: function () { + return this.buttonGroup.getValue(); + } +}); +BI.shortcut("bi.linear_segment", BI.LinearSegment); \ No newline at end of file diff --git a/src/widget/dynamic/datepane/datepane.js b/src/widget/dynamic/datepane/datepane.js index 304e11be9..f559cb8c8 100644 --- a/src/widget/dynamic/datepane/datepane.js +++ b/src/widget/dynamic/datepane/datepane.js @@ -10,7 +10,8 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, { type: "bi.vtape", items: [{ el: { - type: "bi.button_group", + type: "bi.linear_segment", + cls: "bi-border-bottom", height: 30, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), @@ -19,12 +20,8 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicDatePane.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" + textAlign: "center" }), - layouts: [{ - type: "bi.center" - }], listeners: [{ eventName: BI.ButtonGroup.EVENT_CHANGE, action: function () { diff --git a/src/widget/dynamic/year/popup.year.js b/src/widget/dynamic/year/popup.year.js index 84feeb2e2..e56e28645 100644 --- a/src/widget/dynamic/year/popup.year.js +++ b/src/widget/dynamic/year/popup.year.js @@ -96,6 +96,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -104,12 +106,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { diff --git a/src/widget/dynamic/yearmonth/popup.yearmonth.js b/src/widget/dynamic/yearmonth/popup.yearmonth.js index ec129015e..521dda8c7 100644 --- a/src/widget/dynamic/yearmonth/popup.yearmonth.js +++ b/src/widget/dynamic/yearmonth/popup.yearmonth.js @@ -96,6 +96,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -104,12 +106,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { diff --git a/src/widget/dynamic/yearquarter/popup.yearquarter.js b/src/widget/dynamic/yearquarter/popup.yearquarter.js index 19d919e7a..226d560d6 100644 --- a/src/widget/dynamic/yearquarter/popup.yearquarter.js +++ b/src/widget/dynamic/yearquarter/popup.yearquarter.js @@ -89,6 +89,8 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Basic_Year_Fen"), @@ -97,12 +99,8 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicYearQuarterCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { diff --git a/src/widget/dynamicdate/dynamicdate.popup.js b/src/widget/dynamicdate/dynamicdate.popup.js index 06087f522..90ffc8003 100644 --- a/src/widget/dynamicdate/dynamicdate.popup.js +++ b/src/widget/dynamicdate/dynamicdate.popup.js @@ -77,7 +77,8 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, { self.dateTab = this; }, tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", + type: "bi.linear_segment", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"), @@ -86,12 +87,8 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, { text: BI.i18nText("BI-Basic_Dynamic_Title"), value: BI.DynamicDateCombo.Dynamic }], { - textAlign: "center", - cls: "bi-list-item-active" - }), - layouts: [{ - type: "bi.center" - }] + textAlign: "center" + }) }, cardCreator: function (v) { switch (v) { diff --git a/src/widget/multidate/multidate.popup.js b/src/widget/multidate/multidate.popup.js index 007657dc0..3f9f99790 100644 --- a/src/widget/multidate/multidate.popup.js +++ b/src/widget/multidate/multidate.popup.js @@ -64,7 +64,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { this.dateTab = BI.createWidget({ type: "bi.tab", tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", + cls: "bi-border-bottom", height: this.constants.tabHeight, items: BI.createItems([{ text: BI.i18nText("BI-Multi_Date_YMD"),