From 02f29808d7f3f2bd9e688967ff554c198e3c53ff Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Sun, 8 Apr 2018 22:46:29 +0800 Subject: [PATCH] =?UTF-8?q?BI-17580=20=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/version.js | 5 +- dist/bundle.js | 92 +++++++++++++++++-- dist/case.js | 69 +++++++++++++- dist/config.js | 5 +- dist/widget.js | 18 ++-- public/js/index.js | 5 +- src/case/richeditor/bar/texttoolbar.js | 1 + .../richeditor/plugins/combo.fontfamily.js | 67 ++++++++++++++ src/widget/dynamicdate/dynamicdate.trigger.js | 18 ++-- ui/js/index.js | 5 +- 10 files changed, 260 insertions(+), 25 deletions(-) create mode 100644 src/case/richeditor/plugins/combo.fontfamily.js diff --git a/demo/version.js b/demo/version.js index 4c2d725971..b8f3ce97ea 100644 --- a/demo/version.js +++ b/demo/version.js @@ -155,5 +155,8 @@ BI.i18n = { "BI-Conf_Formula_And": "且公式条件", "BI-Conf_Formula_Or": "或公式条件", "BI-Conf_Condition_And": "且条件", - "BI-Conf_Condition_Or": "或条件" + "BI-Conf_Condition_Or": "或条件", + "BI-Microsoft_YaHei": "微软雅黑", + "BI-Apple_Light": "苹方-light", + "BI-Font_Family": "字体" }; \ No newline at end of file diff --git a/dist/bundle.js b/dist/bundle.js index fc822d800e..ffec309b2d 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -82177,6 +82177,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-rich-editor-text-toolbar bi-background", buttons: [ + {type: "bi.rich_editor_font_chooser"}, {type: "bi.rich_editor_size_chooser"}, {type: "bi.rich_editor_bold_button"}, {type: "bi.rich_editor_italic_button"}, @@ -82993,7 +82994,73 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { this.colorchooser.setValue(""); } }); -BI.shortcut("bi.rich_editor_color_chooser", BI.RichEditorColorChooser);/** +BI.shortcut("bi.rich_editor_color_chooser", BI.RichEditorColorChooser);BI.RichEditorFontChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorFontChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-font-chooser bi-border bi-card", + command: "FontName", + width: 50, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.text_trigger", + readonly: true, + height: o.height, + triggerWidth: 16, + text: BI.i18nText("BI-Font_Family") + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + el: this.trigger, + adjustLength: 1, + popup: { + maxWidth: 70, + minWidth: 70, + el: { + type: "bi.button_group", + items: BI.createItems([{ + value: "Microsoft YaHei", + text: BI.i18nText("BI-Microsoft_YaHei") + }, { + value: "PingFangSC-Light !important", + text: BI.i18nText("BI-Apple_Light") + }, { + value: "arial", + text: "Arial" + }, { + value: "Verdana", + text: "Verdana" + }], { + type: "bi.single_select_item" + }), + layouts: [{ + type: "bi.vertical" + }] + } + } + }); + this.combo.on(BI.Combo.EVENT_CHANGE, function () { + var val = this.getValue()[0]; + self.doCommand(val); + this.hideView(); + this.setValue([]); + }); + }, + + hideIf: function (e) { + if(!this.combo.element.find(e.target).length > 0) { + this.combo.hideView(); + } + } +}); +BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser);/** * 字体大小选择 * * Created by GUY on 2015/11/26. @@ -90721,25 +90788,31 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger _getText: function (obj) { var value = ""; + var endText = ""; if(BI.isNotNull(obj.year) && obj.year !== 0) { - value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); + value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); } if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) { - value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); + value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); } if(BI.isNotNull(obj.month) && obj.month !== 0) { - value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); + value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); } if(BI.isNotNull(obj.week) && obj.week !== 0) { - value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); + value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); } if(BI.isNotNull(obj.day) && obj.day !== 0) { - value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; + value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; } if(BI.isNotNull(obj.workDay) && obj.workDay !== 0) { value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } - return value; + return value + endText; function getPositionText (baseText, position) { switch (position) { @@ -111792,5 +111865,8 @@ BI.i18n = { "BI-Conf_Formula_And": "且公式条件", "BI-Conf_Formula_Or": "或公式条件", "BI-Conf_Condition_And": "且条件", - "BI-Conf_Condition_Or": "或条件" + "BI-Conf_Condition_Or": "或条件", + "BI-Microsoft_YaHei": "微软雅黑", + "BI-Apple_Light": "苹方-light", + "BI-Font_Family": "字体" }; \ No newline at end of file diff --git a/dist/case.js b/dist/case.js index bc6e04dcab..4aad1ed77a 100644 --- a/dist/case.js +++ b/dist/case.js @@ -10241,6 +10241,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-rich-editor-text-toolbar bi-background", buttons: [ + {type: "bi.rich_editor_font_chooser"}, {type: "bi.rich_editor_size_chooser"}, {type: "bi.rich_editor_bold_button"}, {type: "bi.rich_editor_italic_button"}, @@ -11057,7 +11058,73 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { this.colorchooser.setValue(""); } }); -BI.shortcut("bi.rich_editor_color_chooser", BI.RichEditorColorChooser);/** +BI.shortcut("bi.rich_editor_color_chooser", BI.RichEditorColorChooser);BI.RichEditorFontChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorFontChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-font-chooser bi-border bi-card", + command: "FontName", + width: 50, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.text_trigger", + readonly: true, + height: o.height, + triggerWidth: 16, + text: BI.i18nText("BI-Font_Family") + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + el: this.trigger, + adjustLength: 1, + popup: { + maxWidth: 70, + minWidth: 70, + el: { + type: "bi.button_group", + items: BI.createItems([{ + value: "Microsoft YaHei", + text: BI.i18nText("BI-Microsoft_YaHei") + }, { + value: "PingFangSC-Light !important", + text: BI.i18nText("BI-Apple_Light") + }, { + value: "arial", + text: "Arial" + }, { + value: "Verdana", + text: "Verdana" + }], { + type: "bi.single_select_item" + }), + layouts: [{ + type: "bi.vertical" + }] + } + } + }); + this.combo.on(BI.Combo.EVENT_CHANGE, function () { + var val = this.getValue()[0]; + self.doCommand(val); + this.hideView(); + this.setValue([]); + }); + }, + + hideIf: function (e) { + if(!this.combo.element.find(e.target).length > 0) { + this.combo.hideView(); + } + } +}); +BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser);/** * 字体大小选择 * * Created by GUY on 2015/11/26. diff --git a/dist/config.js b/dist/config.js index 4c2d725971..b8f3ce97ea 100644 --- a/dist/config.js +++ b/dist/config.js @@ -155,5 +155,8 @@ BI.i18n = { "BI-Conf_Formula_And": "且公式条件", "BI-Conf_Formula_Or": "或公式条件", "BI-Conf_Condition_And": "且条件", - "BI-Conf_Condition_Or": "或条件" + "BI-Conf_Condition_Or": "或条件", + "BI-Microsoft_YaHei": "微软雅黑", + "BI-Apple_Light": "苹方-light", + "BI-Font_Family": "字体" }; \ No newline at end of file diff --git a/dist/widget.js b/dist/widget.js index a96347a365..5fae4eab84 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -4159,25 +4159,31 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger _getText: function (obj) { var value = ""; + var endText = ""; if(BI.isNotNull(obj.year) && obj.year !== 0) { - value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); + value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); } if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) { - value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); + value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); } if(BI.isNotNull(obj.month) && obj.month !== 0) { - value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); + value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); } if(BI.isNotNull(obj.week) && obj.week !== 0) { - value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); + value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); } if(BI.isNotNull(obj.day) && obj.day !== 0) { - value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; + value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; } if(BI.isNotNull(obj.workDay) && obj.workDay !== 0) { value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } - return value; + return value + endText; function getPositionText (baseText, position) { switch (position) { diff --git a/public/js/index.js b/public/js/index.js index 461e6e0feb..1db04d1721 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -155,5 +155,8 @@ BI.i18n = { "BI-Conf_Formula_And": "且公式条件", "BI-Conf_Formula_Or": "或公式条件", "BI-Conf_Condition_And": "且条件", - "BI-Conf_Condition_Or": "或条件" + "BI-Conf_Condition_Or": "或条件", + "BI-Microsoft_YaHei": "微软雅黑", + "BI-Apple_Light": "苹方-light", + "BI-Font_Family": "字体" }; \ No newline at end of file diff --git a/src/case/richeditor/bar/texttoolbar.js b/src/case/richeditor/bar/texttoolbar.js index 1a5b482dcd..46ada8fe14 100644 --- a/src/case/richeditor/bar/texttoolbar.js +++ b/src/case/richeditor/bar/texttoolbar.js @@ -10,6 +10,7 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-rich-editor-text-toolbar bi-background", buttons: [ + {type: "bi.rich_editor_font_chooser"}, {type: "bi.rich_editor_size_chooser"}, {type: "bi.rich_editor_bold_button"}, {type: "bi.rich_editor_italic_button"}, diff --git a/src/case/richeditor/plugins/combo.fontfamily.js b/src/case/richeditor/plugins/combo.fontfamily.js new file mode 100644 index 0000000000..b0c2f49810 --- /dev/null +++ b/src/case/richeditor/plugins/combo.fontfamily.js @@ -0,0 +1,67 @@ +BI.RichEditorFontChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorFontChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-font-chooser bi-border bi-card", + command: "FontName", + width: 50, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.text_trigger", + readonly: true, + height: o.height, + triggerWidth: 16, + text: BI.i18nText("BI-Font_Family") + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + el: this.trigger, + adjustLength: 1, + popup: { + maxWidth: 70, + minWidth: 70, + el: { + type: "bi.button_group", + items: BI.createItems([{ + value: "Microsoft YaHei", + text: BI.i18nText("BI-Microsoft_YaHei") + }, { + value: "PingFangSC-Light !important", + text: BI.i18nText("BI-Apple_Light") + }, { + value: "arial", + text: "Arial" + }, { + value: "Verdana", + text: "Verdana" + }], { + type: "bi.single_select_item" + }), + layouts: [{ + type: "bi.vertical" + }] + } + } + }); + this.combo.on(BI.Combo.EVENT_CHANGE, function () { + var val = this.getValue()[0]; + self.doCommand(val); + this.hideView(); + this.setValue([]); + }); + }, + + hideIf: function (e) { + if(!this.combo.element.find(e.target).length > 0) { + this.combo.hideView(); + } + } +}); +BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser); \ No newline at end of file diff --git a/src/widget/dynamicdate/dynamicdate.trigger.js b/src/widget/dynamicdate/dynamicdate.trigger.js index c480708705..5d8ace3690 100644 --- a/src/widget/dynamicdate/dynamicdate.trigger.js +++ b/src/widget/dynamicdate/dynamicdate.trigger.js @@ -144,25 +144,31 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, { _getText: function (obj) { var value = ""; + var endText = ""; if(BI.isNotNull(obj.year) && obj.year !== 0) { - value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); + value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); } if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) { - value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); + value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); } if(BI.isNotNull(obj.month) && obj.month !== 0) { - value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); + value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); } if(BI.isNotNull(obj.week) && obj.week !== 0) { - value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); + value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); } if(BI.isNotNull(obj.day) && obj.day !== 0) { - value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; + value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); + endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; } if(BI.isNotNull(obj.workDay) && obj.workDay !== 0) { value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); } - return value; + return value + endText; function getPositionText (baseText, position) { switch (position) { diff --git a/ui/js/index.js b/ui/js/index.js index d544428f43..c7b3d64433 100644 --- a/ui/js/index.js +++ b/ui/js/index.js @@ -155,5 +155,8 @@ BI.i18n = { "BI-Conf_Formula_And": "且公式条件", "BI-Conf_Formula_Or": "或公式条件", "BI-Conf_Condition_And": "且条件", - "BI-Conf_Condition_Or": "或条件" + "BI-Conf_Condition_Or": "或条件", + "BI-Microsoft_YaHei": "微软雅黑", + "BI-Apple_Light": "苹方-light", + "BI-Font_Family": "字体" }; \ No newline at end of file