diff --git a/Gruntfile.js b/Gruntfile.js index c6c72e6b5..4ad54940f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -80,32 +80,6 @@ module.exports = function (grunt) { ], dest: 'dist/chart.js' }, - sliderJs: { - src: [ - 'src/addons/sliders/js/**/*.js' - ], - dest: 'dist/sliders.js' - }, - sliderCss: { - src: [ - 'src/addons/sliders/**/*.css' - ], - dest: 'dist/sliders.css' - }, - jqueryuiJs: { - src: [ - 'src/addons/sliders/lib/jquery.ui.core.js', - 'src/addons/sliders/lib/jquery.ui.core.js', - 'src/addons/sliders/lib/jquery.ui.widget.js', - 'src/addons/sliders/lib/jquery.ui.mouse.js', - 'src/addons/sliders/lib/jquery.ui.position.js', - 'src/addons/sliders/lib/jquery.ui.resizable.js', - 'src/addons/sliders/lib/jquery.ui.draggable.js', - 'src/addons/sliders/lib/jquery.ui.droppable.js', - 'src/addons/sliders/lib/jquery.ui.sortable.js' - ], - dest: 'dist/jqueryui.js' - }, coreCss: { src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'], dest: 'dist/core.css' @@ -220,32 +194,6 @@ module.exports = function (grunt) { ], dest: 'bi/chart.js' }, - bi_sliderJs: { - src: [ - 'src/addons/sliders/js/**/*.js' - ], - dest: 'bi/sliders.js' - }, - bi_sliderCss: { - src: [ - 'src/addons/sliders/**/*.css' - ], - dest: 'bi/sliders.css' - }, - bi_jqueryuiJs: { - src: [ - 'src/addons/sliders/lib/jquery.ui.core.js', - 'src/addons/sliders/lib/jquery.ui.core.js', - 'src/addons/sliders/lib/jquery.ui.widget.js', - 'src/addons/sliders/lib/jquery.ui.mouse.js', - 'src/addons/sliders/lib/jquery.ui.position.js', - 'src/addons/sliders/lib/jquery.ui.resizable.js', - 'src/addons/sliders/lib/jquery.ui.draggable.js', - 'src/addons/sliders/lib/jquery.ui.droppable.js', - 'src/addons/sliders/lib/jquery.ui.sortable.js' - ], - dest: 'bi/jqueryui.js' - }, bi_coreCss: { src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'], dest: 'bi/core.css' @@ -261,13 +209,6 @@ module.exports = function (grunt) { }, less: { - sliders: { - expand: true, - cwd: 'src/addons/sliders/less', - src: ['**/*.less'], - dest: 'src/addons/sliders/css/', - ext: '.css' - }, demo: { expand: true, cwd: 'demo/less', diff --git a/bi/base.js b/bi/base.js index 1c179e02d..385dfc7ec 100644 --- a/bi/base.js +++ b/bi/base.js @@ -16270,68 +16270,68 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { key: function (e) { } -});/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorTextToolbar - * @extends BI.Widget - */ -BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-rich-editor-text-toolbar bi-background", - buttons: [ - {type: "bi.rich_editor_size_chooser"}, - {type: "bi.rich_editor_bold_button"}, - {type: "bi.rich_editor_italic_button"}, - {type: "bi.rich_editor_underline_button"}, - {type: "bi.rich_editor_color_chooser"}, - {type: "bi.rich_editor_background_color_chooser"}, - {type: "bi.rich_editor_align_left_button"}, - {type: "bi.rich_editor_align_center_button"}, - {type: "bi.rich_editor_align_right_button"}, - {type: "bi.rich_editor_param_button"}, - ], - height: 28 - }); - }, - - _init: function () { - BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); - var self = this, o = this.options; - BI.createWidget({ - type: "bi.left", - element: this, - items: BI.map(o.buttons, function (i, btn) { - return BI.extend(btn, { - editor: o.editor - }); - }), - hgap: 3, - vgap: 3 - }) - }, - - mounted: function () { - var self = this; - if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 - this.element.mousedown(function () { - self._noSelect(self.element[0]); - }); - this._noSelect(this.element[0]); - } - }, - - _noSelect: function (element) { - if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { - element.setAttribute('unselectable', 'on'); - } - for (var i = 0; i < element.childNodes.length; i++) { - this._noSelect(element.childNodes[i]); - } - } -}); +});/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorTextToolbar + * @extends BI.Widget + */ +BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-text-toolbar bi-background", + buttons: [ + {type: "bi.rich_editor_size_chooser"}, + {type: "bi.rich_editor_bold_button"}, + {type: "bi.rich_editor_italic_button"}, + {type: "bi.rich_editor_underline_button"}, + {type: "bi.rich_editor_color_chooser"}, + {type: "bi.rich_editor_background_color_chooser"}, + {type: "bi.rich_editor_align_left_button"}, + {type: "bi.rich_editor_align_center_button"}, + {type: "bi.rich_editor_align_right_button"}, + {type: "bi.rich_editor_param_button"}, + ], + height: 28 + }); + }, + + _init: function () { + BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + BI.createWidget({ + type: "bi.left", + element: this, + items: BI.map(o.buttons, function (i, btn) { + return BI.extend(btn, { + editor: o.editor + }); + }), + hgap: 3, + vgap: 3 + }) + }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } +}); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** * 富文本编辑器 * @@ -16612,57 +16612,57 @@ BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** } }); }()); -/** - * 颜色选择trigger - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorBackgroundChooserTrigger - * @extends BI.Widget - */ -BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - width: 20, - height: 20 - }); - }, - - _init: function () { - BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); - this.font = BI.createWidget({ - type: "bi.icon_button", - cls: "text-background-font" - }); - - this.underline = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-underline-font" - }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.font, - top: 2, - left: 2 - }, { - el: this.underline, - top: 7, - left: 2 - }] - }) - }, - - setValue: function (color) { - this.underline.element.css("color", color); - }, - - getValue: function () { - return this.font.element.css("color"); - } -}); +/** + * 颜色选择trigger + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorBackgroundChooserTrigger + * @extends BI.Widget + */ +BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + width: 20, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); + this.font = BI.createWidget({ + type: "bi.icon_button", + cls: "text-background-font" + }); + + this.underline = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-underline-font" + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.font, + top: 2, + left: 2 + }, { + el: this.underline, + top: 7, + left: 2 + }] + }) + }, + + setValue: function (color) { + this.underline.element.css("color", color); + }, + + getValue: function () { + return this.font.element.css("color"); + } +}); BI.shortcut('bi.rich_editor_background_color_chooser_trigger', BI.RichEditorBackgroundChooserTrigger);/** * * Created by GUY on 2015/11/26. @@ -16930,214 +16930,214 @@ BI.RichEditorUnderlineButton = BI.inherit(BI.RichEditorAction, { this.underline.setSelected(false); }, }); -BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton)/** - * 颜色选择trigger - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorColorChooserTrigger - * @extends BI.Widget - */ -BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - width: 20, - height: 20 - }); - }, - - _init: function () { - BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); - this.font = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-font" - }); - - this.underline = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-underline-font" - }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.font, - top: 2, - left: 2 - }, { - el: this.underline, - top: 7, - left: 2 - }] - }) - }, - - setValue: function (color) { - this.underline.element.css("color", color); - }, - - getValue: function () { - return this.font.element.css("color"); - } -}); -BI.shortcut('bi.rich_editor_color_chooser_trigger', BI.RichEditorColorChooserTrigger);/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorBackgroundColorChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { - width: 20, - height: 20, - }); - }, - - _init: function () { - BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.colorchooser = BI.createWidget({ - type: "bi.color_chooser", - element: this, - width: o.width, - height: o.height, - el: { - type: "bi.rich_editor_background_color_chooser_trigger", - title: BI.i18nText("BI-Widget_Background_Colour"), - cls: "text-toolbar-button" - } - }); - this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { - var backgroundColor = this.getValue(); - o.editor.element.css({ - backgroundColor: backgroundColor, - color: BI.DOM.getContrastColor(backgroundColor) - }); - this.setValue(""); - }); - }, - - deactivate: function () { - } -}); -BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorColorChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { - width: 20, - height: 20, - command: "foreColor" - }); - }, - - _init: function () { - BI.RichEditorColorChooser.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.colorchooser = BI.createWidget({ - type: "bi.color_chooser", - element: this, - width: o.width, - height: o.height, - el: { - type: "bi.rich_editor_color_chooser_trigger", - title: BI.i18nText("BI-Font_Colour"), - cls: "text-toolbar-button" - } - }); - this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { - self.doCommand(this.getValue()); - }); - - }, - - deactivate: function () { - this.colorchooser.setValue(""); - } -}); -BI.shortcut('bi.rich_editor_color_chooser', BI.RichEditorColorChooser);/** - * 字体大小选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorSizeChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-rich-editor-size-chooser bi-border bi-card", - command: "FontSize", - width: 50, - height: 20 - }); - }, - - _items: [{ - value: 1, - text: "1(8pt)" - }, { - value: 2, - text: "2(10pt)" - }, { - value: 3, - text: "3(12pt)" - }, { - value: 4, - text: "4(14pt)" - }, { - value: 5, - text: "5(18pt)" - }, { - value: 6, - text: "6(24pt)" - }], - - _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_Size") - }); - - 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(this._items, { - 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([]); - }) - } -}); +BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton)/** + * 颜色选择trigger + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorColorChooserTrigger + * @extends BI.Widget + */ +BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + width: 20, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); + this.font = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-font" + }); + + this.underline = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-underline-font" + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.font, + top: 2, + left: 2 + }, { + el: this.underline, + top: 7, + left: 2 + }] + }) + }, + + setValue: function (color) { + this.underline.element.css("color", color); + }, + + getValue: function () { + return this.font.element.css("color"); + } +}); +BI.shortcut('bi.rich_editor_color_chooser_trigger', BI.RichEditorColorChooserTrigger);/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorBackgroundColorChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { + width: 20, + height: 20, + }); + }, + + _init: function () { + BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorchooser = BI.createWidget({ + type: "bi.color_chooser", + element: this, + width: o.width, + height: o.height, + el: { + type: "bi.rich_editor_background_color_chooser_trigger", + title: BI.i18nText("BI-Widget_Background_Colour"), + cls: "text-toolbar-button" + } + }); + this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { + var backgroundColor = this.getValue(); + o.editor.element.css({ + backgroundColor: backgroundColor, + color: BI.DOM.getContrastColor(backgroundColor) + }); + this.setValue(""); + }); + }, + + deactivate: function () { + } +}); +BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorColorChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { + width: 20, + height: 20, + command: "foreColor" + }); + }, + + _init: function () { + BI.RichEditorColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorchooser = BI.createWidget({ + type: "bi.color_chooser", + element: this, + width: o.width, + height: o.height, + el: { + type: "bi.rich_editor_color_chooser_trigger", + title: BI.i18nText("BI-Font_Colour"), + cls: "text-toolbar-button" + } + }); + this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { + self.doCommand(this.getValue()); + }); + + }, + + deactivate: function () { + this.colorchooser.setValue(""); + } +}); +BI.shortcut('bi.rich_editor_color_chooser', BI.RichEditorColorChooser);/** + * 字体大小选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorSizeChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-size-chooser bi-border bi-card", + command: "FontSize", + width: 50, + height: 20 + }); + }, + + _items: [{ + value: 1, + text: "1(8pt)" + }, { + value: 2, + text: "2(10pt)" + }, { + value: 3, + text: "3(12pt)" + }, { + value: 4, + text: "4(14pt)" + }, { + value: 5, + text: "5(18pt)" + }, { + value: 6, + text: "6(24pt)" + }], + + _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_Size") + }); + + 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(this._items, { + 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([]); + }) + } +}); BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** * 富文本编辑器 * @@ -32411,7 +32411,7 @@ BI.Table = BI.inherit(BI.Widget, { }, mounted: function () { - this._resize(); + this._resize && this._resize(); this.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT); }, @@ -32756,9 +32756,7 @@ BI.Table = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.Table.superclass._init.apply(this, arguments); - + render: function () { this.populate(this.options.items); }, diff --git a/bi/sliders.css b/bi/sliders.css index a8d9688bb..66780294e 100644 --- a/bi/sliders.css +++ b/bi/sliders.css @@ -24,27 +24,15 @@ -moz-border-radius: 7px; border-radius: 7px; } -.bi-single-slider-button .slider-button { - cursor: ew-resize; - -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); - -webkit-border-radius: 7px; - -moz-border-radius: 7px; - border-radius: 7px; -} -.bi-slider-track .gray-track { - background-color: rgba(153, 153, 153, 0.3); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d999999,endColorstr=#4d999999); - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} -.bi-slider-track .blue-track { - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} +.bi-single-slider-button .slider-button { + cursor: ew-resize; + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; +} .bi-slider-track .gray-track { background-color: rgba(153, 153, 153, 0.3); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d999999,endColorstr=#4d999999); @@ -57,3 +45,15 @@ -moz-border-radius: 3px; border-radius: 3px; } +.bi-slider-track .gray-track { + background-color: rgba(153, 153, 153, 0.3); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d999999,endColorstr=#4d999999); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.bi-slider-track .blue-track { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} diff --git a/bi/widget.css b/bi/widget.css index d21bb9076..6bf746960 100644 --- a/bi/widget.css +++ b/bi/widget.css @@ -78,6 +78,12 @@ .bi-interactive-arrangement .interactive-arrangement-dragtag-icon { z-index: 1000000000; } +.bi-interval-slider { + min-height: 70px; +} +.bi-interval-slider-label { + min-height: 50px; +} .bi-month-trigger { -webkit-border-radius: 2px; -moz-border-radius: 2px; @@ -310,6 +316,36 @@ box-sizing: border-box; /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ } +.bi-single-slider-label { + min-height: 50px; +} +.bi-single-slider-normal { + min-height: 30px; +} +.bi-single-slider { + min-height: 50px; +} +.bi-single-slider-button .slider-button { + cursor: ew-resize; + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; +} +.bi-slider-track .gray-track { + background-color: rgba(153, 153, 153, 0.3); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d999999,endColorstr=#4d999999); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.bi-slider-track .blue-track { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} .bi-param-time-interval.time-error .bi-input { color: #e85050; } diff --git a/bi/widget.js b/bi/widget.js index 2142e0abd..13f2f0e84 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -3286,7 +3286,7 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { var self = this, o = this.options; var routes = this.pathChooser.routes; var pathes = this.pathChooser.pathes; - var store = this.pathChooser.store; + var cache = this.pathChooser.cache; this.arrows = {}; BI.each(routes, function (region, ps) { self.arrows[region] = []; @@ -3298,7 +3298,7 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { var arrow; if (dot.y === dots[i - 1].y) { if (dots[i + 1].y != dot.y) { - if (store[path[path.length - 2]].direction === -1) { + if (cache[path[path.length - 2]].direction === -1) { if (i - 1 > 0) { arrow = self._drawOneArrow(dots[i - 1], 3); } @@ -3308,13 +3308,13 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { } } else if (dot.x === dots[i - 1].x) { if (dot.y > dots[i - 1].y) { - if (store[BI.first(path)].direction === -1) { + if (cache[BI.first(path)].direction === -1) { arrow = self._drawOneArrow(dots[i - 1], 0); } else { arrow = self._drawOneArrow(dot, 2); } } else { - if (store[path[path.length - 2]].direction === -1) { + if (cache[path[path.length - 2]].direction === -1) { arrow = self._drawOneArrow(dots[i - 1], 2); } else { arrow = self._drawOneArrow(dot, 0); @@ -3330,7 +3330,7 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { if (i !== 0) { var arrow; var from = path[i - 1]; - if (store[from].direction === -1) { + if (cache[from].direction === -1) { var regionIndex = self.pathChooser.getRegionIndexById(from); var x = getXoffsetByRegionIndex(regionIndex, -1); var y = getYByXoffset(dots, x); @@ -5605,1778 +5605,2954 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, { BI.InteractiveArrangement.EVENT_RESIZE = "InteractiveArrangement.EVENT_RESIZE"; BI.InteractiveArrangement.EVENT_SCROLL = "InteractiveArrangement.EVENT_SCROLL"; BI.shortcut('bi.interactive_arrangement', BI.InteractiveArrangement);/** - * 月份下拉框 - * - * Created by GUY on 2015/8/28. - * @class BI.MonthCombo - * @extends BI.Trigger + * Created by zcf on 2016/9/26. */ -BI.MonthCombo = BI.inherit(BI.Widget, { +BI.IntervalSlider = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 58, + EDITOR_R_GAP: 60, + EDITOR_HEIGHT: 30, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + _defaultConfig: function () { - return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-month-combo", - behaviors: {}, - height: 25 - }); + return BI.extend(BI.IntervalSlider.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-interval-slider bi-slider-track" + }) }, + _init: function () { - BI.MonthCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; + BI.IntervalSlider.superclass._init.apply(this, arguments); - this.trigger = BI.createWidget({ - type: "bi.month_trigger" + var self = this; + var c = this._constant; + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.calculation = new BI.AccurateCalculationModel(); + + // this.backgroundTrack = BI.createWidget({ + // type: "bi.layout", + // cls: "background-track", + // height: c.TRACK_HEIGHT + // }); + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 }); + this.track = this._createTrackWrapper(); - 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(); + this.labelOne = BI.createWidget({ + type: "bi.sign_editor", + cls: "slider-editor-button", + errorText: "", + allowBlank: false, + width: c.EDITOR_WIDTH, + validationChecker: function (v) { + return self._checkValidation(v); } - self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); }); - this.trigger.on(BI.MonthTrigger.EVENT_FOCUS, function () { - self.storeValue = this.getKey(); + this.labelOne.element.hover(function () { + self.labelOne.element.removeClass("bi-border").addClass("bi-border"); + }, function () { + self.labelOne.element.removeClass("bi-border"); }); - this.trigger.on(BI.MonthTrigger.EVENT_START, function () { - self.combo.hideView(); + this.labelOne.on(BI.Editor.EVENT_CONFIRM, function () { + var v = BI.parseFloat(this.getValue()); + self.valueOne = v; + var percent = self._getPercentByValue(v); + var significantPercent = BI.parseFloat(percent.toFixed(1));//分成1000份 + self._setLabelOnePosition(significantPercent); + self._setSliderOnePosition(significantPercent); + self._setBlueTrack(); + self.fireEvent(BI.IntervalSlider.EVENT_CHANGE); }); - this.trigger.on(BI.MonthTrigger.EVENT_STOP, function () { - if (!self.combo.isViewVisible()) { - self.combo.showView(); + + this.labelTwo = BI.createWidget({ + type: "bi.sign_editor", + cls: "slider-editor-button", + errorText: "", + allowBlank: false, + width: c.EDITOR_WIDTH, + validationChecker: function (v) { + return self._checkValidation(v); } }); - - this.popup = BI.createWidget({ - type: "bi.month_popup", - behaviors: o.behaviors + this.labelTwo.element.hover(function () { + self.labelTwo.element.removeClass("bi-border").addClass("bi-border"); + }, function () { + self.labelTwo.element.removeClass("bi-border"); }); - this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); - self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); + this.labelTwo.on(BI.Editor.EVENT_CONFIRM, function () { + var v = BI.parseFloat(this.getValue()); + self.valueTwo = v; + var percent = self._getPercentByValue(v); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setLabelTwoPosition(significantPercent); + self._setSliderTwoPosition(significantPercent); + self._setBlueTrack(); + self.fireEvent(BI.IntervalSlider.EVENT_CHANGE); }); - this.combo = BI.createWidget({ - type: "bi.combo", - element: this, - isNeedAdjustHeight: false, - isNeedAdjustWidth: false, - el: this.trigger, - popup: { - minWidth: 85, - el: this.popup - } + this.sliderOne = BI.createWidget({ + type: "bi.single_slider_button" }); - this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { - self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW); + this.sliderTwo = BI.createWidget({ + type: "bi.single_slider_button" }); - }, + this._draggable(this.sliderOne, true); + this._draggable(this.sliderTwo, false); + this._setVisible(false); - setValue: function (v) { - this.trigger.setValue(v); - this.popup.setValue(v); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 23, + left: 0, + width: "100%" + }, + this._createLabelWrapper(), + this._createSliderWrapper() + ] + }) }, - getValue: function () { - return this.popup.getValue(); - } -}); + _rePosBySizeAfterMove: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + var v = this._getValueByPercent(significantPercent); + v = this._assertValue(v); + if(isLeft){ + this._setLabelOnePosition(significantPercent); + this._setSliderOnePosition(significantPercent); + this.labelOne.setValue(v); + this.valueOne = v; + }else{ + this._setLabelTwoPosition(significantPercent); + this._setSliderTwoPosition(significantPercent); + this.labelTwo.setValue(v); + this.valueTwo = v; + } + this._setBlueTrack(); + }, -BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; -BI.shortcut('bi.month_combo', BI.MonthCombo);/** - * 月份展示面板 - * - * Created by GUY on 2015/9/2. - * @class BI.MonthPopup - * @extends BI.Trigger - */ -BI.MonthPopup = BI.inherit(BI.Widget, { + _rePosBySizeAfterStop: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + isLeft ? this._setSliderOnePosition(significantPercent) : this._setSliderTwoPosition(significantPercent); + }, - _defaultConfig: function () { - return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-month-popup", - behaviors: {} + _draggable: function (widget, isLeft) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + self._rePosBySizeAfterMove(size, isLeft); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + self._rePosBySizeAfterStop(size, isLeft); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.IntervalSlider.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } }, - _init: function () { - BI.MonthPopup.superclass._init.apply(this, arguments); - var self = this, o = this.options; + _createLabelWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.labelOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.labelTwo, + top: 0, + left: "100%" + }] + }], + rgap: c.EDITOR_R_GAP, + height: 70 + }, + top: 0, + left: 0, + width: "100%" + } + }, - //纵向排列月 - var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; - var items = []; - items.push(month.slice(0, 2)); - items.push(month.slice(2, 4)); - items.push(month.slice(4, 6)); - items.push(month.slice(6, 8)); - items.push(month.slice(8, 10)); - items.push(month.slice(10, 12)); - items = BI.map(items, function (i, item) { - return BI.map(item, function (j, td) { - return { - type: "bi.text_item", - cls: "bi-list-item-active", - textAlign: "center", - whiteSpace: "nowrap", - once: false, - forceSelected: true, - height: 23, - width: 38, - value: td, - text: td + 1 - }; - }); - }); + _createSliderWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.sliderOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.sliderTwo, + top: 0, + left: "100%" + }] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }, + top: 20, + left: 0, + width: "100%" + } + }, - this.month = BI.createWidget({ - type: "bi.button_group", - element: this, - behaviors: o.behaviors, - items: BI.createItems(items, {}), - layouts: [BI.LogicFactory.createLogic("table", BI.extend({ - dynamic: true - }, { - columns: 2, - rows: 6, - columnSize: [1 / 2, 1 / 2], - rowSize: 25 - })), { - type: "bi.center_adapt", - vgap: 1, - hgap: 2 + _createTrackWrapper: function () { + return BI.createWidget({ + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" }] - }); + }) + }, - this.month.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); + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _checkOverlap: function () { + var labelOneLeft = this.labelOne.element[0].offsetLeft; + var labelTwoLeft = this.labelTwo.element[0].offsetLeft; + if (labelOneLeft <= labelTwoLeft) { + if ((labelTwoLeft - labelOneLeft) < 90) { + this.labelTwo.element.css({"top": 40}); + } else { + this.labelTwo.element.css({"top": 0}); } - }) + } else { + if ((labelOneLeft - labelTwoLeft) < 90) { + this.labelTwo.element.css({"top": 40}); + } else { + this.labelTwo.element.css({"top": 0}); + } + } }, - getValue: function () { - return this.month.getValue()[0]; + _setLabelOnePosition: function (percent) { + this.labelOne.element.css({"left": percent + "%"}); + this._checkOverlap(); }, - setValue: function (v) { - this.month.setValue([v]); - } -}); -BI.MonthPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.month_popup", BI.MonthPopup);/** - * 月份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, - errorText: BI.i18nText("BI-Month_Trigger_Error_Text") + _setLabelTwoPosition: function (percent) { + this.labelTwo.element.css({"left": percent + "%"}); + this._checkOverlap(); }, - _defaultConfig: function () { - return BI.extend(BI.MonthTrigger.superclass._defaultConfig.apply(this, arguments), { - extraCls: "bi-month-trigger bi-border", - height: 24 - }); + _setSliderOnePosition: function (percent) { + this.sliderOne.element.css({"left": percent + "%"}); }, - _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: c.errorText - }); - 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 - } - ] - }); + + _setSliderTwoPosition: function (percent) { + this.sliderTwo.element.css({"left": percent + "%"}); }, - setValue: function (v) { - if(BI.isNotNull(v)){ - this.editor.setState(v + 1); - this.editor.setValue(v + 1); - this.editor.setTitle(v + 1); - return; + + _setBlueTrackLeft: function (percent) { + this.blueTrack.element.css({"left": percent + "%"}); + }, + + _setBlueTrackWidth: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setBlueTrack: function () { + var percentOne = this._getPercentByValue(this.labelOne.getValue()); + var percentTwo = this._getPercentByValue(this.labelTwo.getValue()); + if (percentOne <= percentTwo) { + this._setBlueTrackLeft(percentOne); + this._setBlueTrackWidth(percentTwo - percentOne); + } else { + this._setBlueTrackLeft(percentTwo); + this._setBlueTrackWidth(percentOne - percentTwo); } - this.editor.setState(""); - this.editor.setValue(""); - this.editor.setTitle(""); }, - getKey: function () { - return this.editor.getValue() | 0; + + _setAllPosition: function (one, two) { + this._setSliderOnePosition(one); + this._setLabelOnePosition(one); + this._setSliderTwoPosition(two); + this._setLabelTwoPosition(two); + this._setBlueTrack(); }, - 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);/** - * 普通控件 - * - * @class BI.MultiDateCard - * @extends BI.Widget - * @abstract - */ -BI.MultiDateCard = BI.inherit(BI.Widget, { - constants: { - lgap: 80, - itemHeight: 35, - defaultEditorValue: "1" + _setVisible: function (visible) { + this.sliderOne.setVisible(visible); + this.sliderTwo.setVisible(visible); + this.labelOne.setVisible(visible); + this.labelTwo.setVisible(visible); }, - _defaultConfig: function () { - return $.extend(BI.MultiDateCard.superclass._defaultConfig.apply(this, arguments), {}); + _setErrorText: function () { + var errorText = BI.i18nText("BI-Please_Enter") + this.min + "-" + this.max + BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Basic_Number"); + this.labelOne.setErrorText(errorText); + this.labelTwo.setErrorText(errorText); }, - dateConfig: function () { + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + //其中取max-min后保留4为有效数字后的值的小数位数为最终value的精度 + _getValueByPercent: function (percent) {//return (((max-min)*percent)/100+min) + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var mul = this.calculation.accurateMultiplication(sub, percent); + var div = this.calculation.accurateDivisionTenExponent(mul, 2); + if(this.precision < 0){ + var value = BI.parseFloat(this.calculation.accurateAddition(div, this.min)); + var reduceValue = Math.round(this.calculation.accurateDivisionTenExponent(value, -this.precision)); + return this.calculation.accurateMultiplication(reduceValue, Math.pow(10, -this.precision)); + }else{ + return BI.parseFloat(this.calculation.accurateAddition(div, this.min).toFixed(this.precision)); + } }, - defaultSelectedItem: function () { + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + _setDraggableEnable: function (enable) { + this.sliderOne.setEnable(enable); + this.sliderTwo.setEnable(enable); + }, + + _getPrecision: function () { + //计算每一份值的精度(最大值和最小值的差值保留4为有效数字后的精度) + //如果差值的整数位数大于4,toPrecision(4)得到的是科学计数法123456 => 1.235e+5 + //返回非负值: 保留的小数位数 + //返回负值: 保留的10^n精度中的n + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var pre = sub.toPrecision(4); + //科学计数法 + var eIndex = pre.indexOf("e"); + var arr = []; + if(eIndex > -1){ + arr = pre.split("e"); + var decimalPartLength = BI.size(arr[0].split(".")[1]); + var sciencePartLength = BI.parseInt(arr[1].substring(1)); + return decimalPartLength - sciencePartLength; + }else{ + arr = pre.split("."); + return arr.length > 1 ? arr[1].length : 0; + } + }, + + _assertValue: function (value) { + if(value <= this.min){ + return this.min + } + if(value >= this.max){ + return this.max; + } + return value; + }, + + getValue: function () { + if (this.valueOne <= this.valueTwo) { + return {min: this.valueOne, max: this.valueTwo} + } else { + return {min: this.valueTwo, max: this.valueOne} + } + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber >= minNumber )) { + this.min = minNumber; + this.max = maxNumber; + this.valueOne = minNumber; + this.valueTwo = maxNumber; + this.precision = this._getPrecision(); + this._setDraggableEnable(true); + } + if (maxNumber === minNumber) { + this._setDraggableEnable(false); + } + }, + + setValue: function (v) { + var valueOne = BI.parseFloat(v.min); + var valueTwo = BI.parseFloat(v.max); + if (!isNaN(valueOne) && !isNaN(valueTwo)) { + if (this._checkValidation(valueOne)) { + this.valueOne = valueOne; + } + if (this._checkValidation(valueTwo)) { + this.valueTwo = valueTwo; + } + if (valueOne < this.min) { + this.valueOne = this.min; + } + if (valueTwo > this.max) { + this.valueTwo = this.max; + } + } + }, + reset: function () { + this._setVisible(false); + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.min = NaN; + this.max = NaN; + this._setBlueTrackWidth(0); + }, + + populate: function () { + if (!isNaN(this.min) && !isNaN(this.max)) { + this.enable = true; + this._setVisible(true); + this._setErrorText(); + if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { + this.labelOne.setValue(this.valueOne); + this.labelTwo.setValue(this.valueTwo); + this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); + } else { + this.labelOne.setValue(this.min); + this.labelTwo.setValue(this.max); + this._setAllPosition(0, 100) + } + } + } +}); +BI.IntervalSlider.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.interval_slider", BI.IntervalSlider);/** + * Created by zcf on 2016/9/26. + */ +BI.IntervalSliderLabel = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 58, + EDITOR_R_GAP: 60, + EDITOR_HEIGHT: 20, + HEIGHT: 20, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + + _defaultConfig: function () { + return BI.extend(BI.IntervalSliderLabel.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-interval-slider-label bi-slider-track", + digit: false, + unit: "" + }) }, _init: function () { - BI.MultiDateCard.superclass._init.apply(this, arguments); - var self = this, opts = this.options; + BI.IntervalSliderLabel.superclass._init.apply(this, arguments); - this.label = BI.createWidget({ - type: 'bi.label', - height: this.constants.itemHeight, - textAlign: "left", - text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"), - cls: 'bi-multidate-inner-label bi-tips' + var self = this, o = this.options; + var c = this._constant; + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.calculation = new BI.AccurateCalculationModel(); + + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 }); - this.radioGroup = BI.createWidget({ - type: "bi.button_group", - chooseType: 0, - items: BI.createItems(this.dateConfig(), { - type: 'bi.multidate_segment', - height: this.constants.itemHeight - }), - layouts: [{ - type: "bi.vertical" - }] + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 }); + this.track = this._createTrackWrapper(); - this.radioGroup.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CONFIRM) { - self.fireEvent(BI.MultiDateCard.EVENT_CHANGE); - } + this.labelOne = BI.createWidget({ + type: "bi.label", + height: c.HEIGHT, + width: c.EDITOR_WIDTH }); - this.radioGroup.on(BI.ButtonGroup.EVENT_CHANGE, function () { - self.setValue(self.getValue()); - self.fireEvent(BI.MultiDateCard.EVENT_CHANGE); + + this.labelTwo = BI.createWidget({ + type: "bi.label", + height: c.HEIGHT, + width: c.EDITOR_WIDTH + }); + + this.sliderOne = BI.createWidget({ + type: "bi.single_slider_button" }); + + this.sliderTwo = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.sliderOne, true); + this._draggable(this.sliderTwo, false); + this._setVisible(false); + BI.createWidget({ + type: "bi.absolute", element: this, - type: 'bi.center_adapt', - lgap: this.constants.lgap, items: [{ - type: 'bi.vertical', - items: [this.label, this.radioGroup] - }] - }); + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 13, + left: 0, + width: "100%" + }, + this._createLabelWrapper(), + this._createSliderWrapper() + ] + }) }, - getValue: function () { - var button = this.radioGroup.getSelectedButtons()[0]; - var type = button.getValue(), value = button.getInputValue(); - return { - type: type, - value: value + _rePosBySizeAfterMove: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + var v = this._getValueByPercent(significantPercent); + v = this._assertValue(v); + if(isLeft){ + this._setLabelOnePosition(significantPercent); + this._setSliderOnePosition(significantPercent); + this.labelOne.setValue(v); + this.valueOne = v; + }else{ + this._setLabelTwoPosition(significantPercent); + this._setSliderTwoPosition(significantPercent); + this.labelTwo.setValue(v); + this.valueTwo = v; } + this._setBlueTrack(); }, - _isTypeAvaliable: function (type) { - var res = false; - BI.find(this.dateConfig(), function (i, item) { - if (item.value === type) { - res = true; - return true; + _rePosBySizeAfterStop: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + isLeft ? this._setSliderOnePosition(significantPercent) : this._setSliderTwoPosition(significantPercent); + }, + + _draggable: function (widget, isLeft) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + self._rePosBySizeAfterMove(size, isLeft); } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + self._rePosBySizeAfterStop(size, isLeft); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.IntervalSliderLabel.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); }); - return res; + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } }, - setValue: function (v) { - var self = this; - if (BI.isNotNull(v) && this._isTypeAvaliable(v.type)) { - this.radioGroup.setValue(v.type); - BI.each(this.radioGroup.getAllButtons(), function (i, button) { - if (button.isEditorExist() === true && button.isSelected()) { - button.setInputValue(v.value); - } else { - button.setInputValue(self.constants.defaultEditorValue); - } - }); - } else { - this.radioGroup.setValue(this.defaultSelectedItem()); - BI.each(this.radioGroup.getAllButtons(), function (i, button) { - button.setInputValue(self.constants.defaultEditorValue); - }); + _createLabelWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.labelOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.labelTwo, + top: 0, + left: "100%" + }] + }], + rgap: c.EDITOR_R_GAP, + height: 50 + }, + top: 0, + left: 0, + width: "100%" } }, - getCalculationValue: function () { - var valueObject = this.getValue(); - var type = valueObject.type, value = valueObject.value; - switch (type) { - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: - return new Date().getOffsetDate(-1 * value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: - return new Date().getOffsetDate(value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: - return new Date(); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: - return new Date().getBeforeMultiMonth(value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: - return new Date().getAfterMultiMonth(value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: - return new Date(new Date().getFullYear(), new Date().getMonth(), 1); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: - return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate()); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: - return new Date().getBeforeMulQuarter(value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: - return new Date().getAfterMulQuarter(value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: - return new Date().getQuarterStartDate(); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: - return new Date().getQuarterEndDate(); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: - return new Date().getOffsetDate(-7 * value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: - return new Date().getOffsetDate(7 * value); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: - return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate()); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: - return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate()); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: - return new Date(new Date().getFullYear(), 0, 1); - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: - return new Date(new Date().getFullYear(), 11, 31); + _createSliderWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.sliderOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.sliderTwo, + top: 0, + left: "100%" + }] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }, + top: 10, + left: 0, + width: "100%" } - } -}); -BI.MultiDateCard.EVENT_CHANGE = "EVENT_CHANGE"; -/** - * 日期控件 - * @class BI.MultiDateCombo - * @extends BI.Widget - */ -BI.MultiDateCombo = BI.inherit(BI.Single, { - constants: { - popupHeight: 259, - popupWidth: 270, - comboAdjustHeight: 1, - border: 1, - DATE_MIN_VALUE: "1900-01-01", - DATE_MAX_VALUE: "2099-12-31" - }, - _defaultConfig: function () { - return BI.extend(BI.MultiDateCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-combo bi-border', - height: 24 - }); }, - _init: function () { - BI.MultiDateCombo.superclass._init.apply(this, arguments); - var self = this, opts = this.options; - this.storeTriggerValue = ""; - var date = new Date(); - this.storeValue = null; - this.trigger = BI.createWidget({ - type: 'bi.date_trigger', - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE - }); - this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function () { - if (self.combo.isViewVisible()) { - self.combo.hideView(); - } - }); - this.trigger.on(BI.DateTrigger.EVENT_STOP, function () { - if (!self.combo.isViewVisible()) { - self.combo.showView(); - } - }); - this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () { - self.combo.toggle(); - }); - this.trigger.on(BI.DateTrigger.EVENT_FOCUS, function () { - self.storeTriggerValue = self.trigger.getKey(); - if (!self.combo.isViewVisible()) { - self.combo.showView(); - } - self.fireEvent(BI.MultiDateCombo.EVENT_FOCUS); - }); - this.trigger.on(BI.DateTrigger.EVENT_ERROR, function () { - self.storeValue = { - year: date.getFullYear(), - month: date.getMonth() - }; - self.popup.setValue(); - self.fireEvent(BI.MultiDateCombo.EVENT_ERROR); - }); - this.trigger.on(BI.DateTrigger.EVENT_VALID, function () { - self.fireEvent(BI.MultiDateCombo.EVENT_VALID); - }); - this.trigger.on(BI.DateTrigger.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiDateCombo.EVENT_CHANGE); - }); - this.trigger.on(BI.DateTrigger.EVENT_CONFIRM, function () { - if (self.combo.isViewVisible()) { - return; - } - var dateStore = self.storeTriggerValue; - var dateObj = self.trigger.getKey(); - if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { - self.storeValue = self.trigger.getValue(); - self.setValue(self.trigger.getValue()); - } else if (BI.isEmptyString(dateObj)) { - self.storeValue = null; - self.trigger.setValue(); - } - self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); - }); - this.popup = BI.createWidget({ - type: "bi.multidate_popup", - min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE - }); - this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () { - self.setValue(); - self.combo.hideView(); - self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); - }); - this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () { - var date = new Date(); - self.setValue({ - year: date.getFullYear(), - month: date.getMonth(), - day: date.getDate() - }); - self.combo.hideView(); - self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); - }); - this.popup.on(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); - self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); - }); - this.popup.on(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); - //self.fireEvent(BI.MultiDateCombo.EVENT_CHANGE); - self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); - }); - this.combo = BI.createWidget({ - type: 'bi.combo', - toggle: false, - isNeedAdjustHeight: false, - isNeedAdjustWidth: false, - el: this.trigger, - adjustLength: this.constants.comboAdjustHeight, - popup: { - el: this.popup, - maxHeight: this.constants.popupHeight, - width: this.constants.popupWidth, - stopPropagation: false - } - }); - this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { - self.popup.setValue(self.storeValue); - self.fireEvent(BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW); - }); - - var triggerBtn = BI.createWidget({ - type: "bi.icon_button", - cls: "bi-trigger-icon-button date-font", - width: 24, - height: 24 - }); - triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { - if (self.combo.isViewVisible()) { - self.combo.hideView(); - } else { - self.combo.showView(); - } - }); - this.changeIcon = BI.createWidget({ - type: "bi.icon_button", - cls: "bi-trigger-icon-button date-change-h-font", - width: 24, - height: 24 - }); - - var leftPart = BI.createWidget({ + _createTrackWrapper: function () { + return BI.createWidget({ type: "bi.absolute", items: [{ - el: this.combo, - top: 0, + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, left: 0, - right: 0, - bottom: 0 - }, { - el: triggerBtn, - top: 0, - left: 0 + width: "100%" }] - }); + }) + }, - BI.createWidget({ - type: "bi.htape", - element: this, - items: [leftPart, { - el: this.changeIcon, - width: 30 - }], - ref: function (_ref) { - self.comboWrapper = _ref; + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _checkOverlap: function () { + var labelOneLeft = this.labelOne.element[0].offsetLeft; + var labelTwoLeft = this.labelTwo.element[0].offsetLeft; + if (labelOneLeft <= labelTwoLeft) { + if ((labelTwoLeft - labelOneLeft) < 90) { + this.labelTwo.element.css({"top": 30}); + } else { + this.labelTwo.element.css({"top": 0}); } - }) + } else { + if ((labelOneLeft - labelTwoLeft) < 90) { + this.labelTwo.element.css({"top": 30}); + } else { + this.labelTwo.element.css({"top": 0}); + } + } }, - _checkDynamicValue: function (v) { - var type = null; - if (BI.isNotNull(v)) { - type = v.type + _setLabelOnePosition: function (percent) { + this.labelOne.element.css({"left": percent + "%"}); + this._checkOverlap(); + }, + + _setLabelTwoPosition: function (percent) { + this.labelTwo.element.css({"left": percent + "%"}); + this._checkOverlap(); + }, + + _setSliderOnePosition: function (percent) { + this.sliderOne.element.css({"left": percent + "%"}); + }, + + _setSliderTwoPosition: function (percent) { + this.sliderTwo.element.css({"left": percent + "%"}); + }, + + _setBlueTrackLeft: function (percent) { + this.blueTrack.element.css({"left": percent + "%"}); + }, + + _setBlueTrackWidth: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setBlueTrack: function () { + var percentOne = this._getPercentByValue(this.labelOne.getValue()); + var percentTwo = this._getPercentByValue(this.labelTwo.getValue()); + if (percentOne <= percentTwo) { + this._setBlueTrackLeft(percentOne); + this._setBlueTrackWidth(percentTwo - percentOne); + } else { + this._setBlueTrackLeft(percentTwo); + this._setBlueTrackWidth(percentOne - percentTwo); } - switch (type) { - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: - this.changeIcon.setVisible(true); - this.comboWrapper.attr("items")[1].width = 30; - this.comboWrapper.resize(); - break; - default: - this.comboWrapper.attr("items")[1].width = 0; - this.comboWrapper.resize(); - this.changeIcon.setVisible(false); - break; + }, + + _setAllPosition: function (one, two) { + this._setSliderOnePosition(one); + this._setLabelOnePosition(one); + this._setSliderTwoPosition(two); + this._setLabelTwoPosition(two); + this._setBlueTrack(); + }, + + _setVisible: function (visible) { + this.sliderOne.setVisible(visible); + this.sliderTwo.setVisible(visible); + this.labelOne.setVisible(visible); + this.labelTwo.setVisible(visible); + }, + + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + + //其中取max-min后保留4为有效数字后的值的小数位数为最终value的精度 + _getValueByPercent: function (percent) {//return (((max-min)*percent)/100+min) + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var mul = this.calculation.accurateMultiplication(sub, percent); + var div = this.calculation.accurateDivisionTenExponent(mul, 2); + if (this.precision < 0) { + var value = BI.parseFloat(this.calculation.accurateAddition(div, this.min)); + var reduceValue = Math.round(this.calculation.accurateDivisionTenExponent(value, -this.precision)); + return this.calculation.accurateMultiplication(reduceValue, Math.pow(10, -this.precision)); + } else { + return BI.parseFloat(this.calculation.accurateAddition(div, this.min).toFixed(this.precision)); } }, - setValue: function (v) { - this.storeValue = v; - this.popup.setValue(v); - this.trigger.setValue(v); - this._checkDynamicValue(v) + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + _setDraggableEnable: function (enable) { + this.sliderOne.setEnable(enable); + this.sliderTwo.setEnable(enable); + }, + + _getPrecision: function () { + //计算每一份值的精度(最大值和最小值的差值保留4为有效数字后的精度) + //如果差值的整数位数大于4,toPrecision(4)得到的是科学计数法123456 => 1.235e+5 + //返回非负值: 保留的小数位数 + //返回负值: 保留的10^n精度中的n + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var pre = sub.toPrecision(4); + //科学计数法 + var eIndex = pre.indexOf("e"); + var arr = []; + if (eIndex > -1) { + arr = pre.split("e"); + var decimalPartLength = BI.size(arr[0].split(".")[1]); + var sciencePartLength = BI.parseInt(arr[1].substring(1)); + return decimalPartLength - sciencePartLength; + } else { + arr = pre.split("."); + return arr.length > 1 ? arr[1].length : 0; + } + }, + + _assertValue: function (value) { + if (value <= this.min) { + return this.min + } + if (value >= this.max) { + return this.max; + } + return value; }, + getValue: function () { - return this.storeValue; + if (this.valueOne <= this.valueTwo) { + return {min: this.valueOne, max: this.valueTwo} + } else { + return {min: this.valueTwo, max: this.valueOne} + } }, - getKey: function () { - return this.trigger.getKey(); + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber >= minNumber )) { + this.min = minNumber; + this.max = maxNumber; + this.valueOne = minNumber; + this.valueTwo = maxNumber; + this.precision = this._getPrecision(); + this._setDraggableEnable(true); + } + if (maxNumber === minNumber) { + this._setDraggableEnable(false); + } }, - hidePopupView: function () { - this.combo.hideView(); - } -}); -BI.shortcut('bi.multidate_combo', BI.MultiDateCombo); -BI.MultiDateCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.MultiDateCombo.EVENT_FOCUS = "EVENT_FOCUS"; -BI.MultiDateCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.MultiDateCombo.EVENT_VALID = "EVENT_VALID"; -BI.MultiDateCombo.EVENT_ERROR = "EVENT_ERROR"; -BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW = "BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW"; + setValue: function (v) { + var o = this.options; + var valueOne = BI.parseFloat(v.min); + var valueTwo = BI.parseFloat(v.max); + valueOne = o.digit === false ? valueOne : valueOne.toFixed(o.digit); + if (!isNaN(valueOne) && !isNaN(valueTwo)) { + if (this._checkValidation(valueOne)) { + this.valueOne = valueOne; + } + if (this._checkValidation(valueTwo)) { + this.valueTwo = valueTwo; + } + if (valueOne < this.min) { + this.valueOne = this.min; + } + if (valueTwo > this.max) { + this.valueTwo = this.max; + } + } + }, -BI.extend(BI.MultiDateCombo, { - MULTI_DATE_YMD_CARD: 1, - MULTI_DATE_YEAR_CARD: 2, - MULTI_DATE_QUARTER_CARD: 3, - MULTI_DATE_MONTH_CARD: 4, - MULTI_DATE_WEEK_CARD: 5, - MULTI_DATE_DAY_CARD: 6 -}); + reset: function () { + this._setVisible(false); + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.min = NaN; + this.max = NaN; + this._setBlueTrackWidth(0); + }, -BI.extend(BI.MultiDateCombo, { - DATE_TYPE: { - MULTI_DATE_YEAR_PREV: 1, - MULTI_DATE_YEAR_AFTER: 2, - MULTI_DATE_YEAR_BEGIN: 3, - MULTI_DATE_YEAR_END: 4, - MULTI_DATE_MONTH_PREV: 5, - MULTI_DATE_MONTH_AFTER: 6, - MULTI_DATE_MONTH_BEGIN: 7, - MULTI_DATE_MONTH_END: 8, - MULTI_DATE_QUARTER_PREV: 9, - MULTI_DATE_QUARTER_AFTER: 10, - MULTI_DATE_QUARTER_BEGIN: 11, - MULTI_DATE_QUARTER_END: 12, - MULTI_DATE_WEEK_PREV: 13, - MULTI_DATE_WEEK_AFTER: 14, - MULTI_DATE_DAY_PREV: 15, - MULTI_DATE_DAY_AFTER: 16, - MULTI_DATE_DAY_TODAY: 17, - MULTI_DATE_PARAM: 18, - MULTI_DATE_CALENDAR: 19, - YEAR_QUARTER: 20, - YEAR_MONTH: 21, - YEAR_WEEK: 22, - YEAR_DAY: 23, - MONTH_WEEK: 24, - MONTH_DAY: 25, - YEAR: 26, - SAME_PERIOD: 27, - LAST_SAME_PERIOD: 28 + populate: function () { + var o = this.options; + if (!isNaN(this.min) && !isNaN(this.max)) { + this.enable = true; + this._setVisible(true); + if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { + this.labelOne.setValue(this.valueOne); + this.labelTwo.setValue(this.valueTwo); + this.labelOne.setText(this.valueOne + o.unit); + this.labelTwo.setText(this.valueTwo + o.unit); + this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); + } else { + this.labelOne.setValue(this.min); + this.labelTwo.setValue(this.max); + this.labelOne.setText(this.min + o.unit); + this.labelTwo.setText(this.max + o.unit); + this._setAllPosition(0, 100) + } + } } }); -/** - * 普通控件 - * - * @class BI.DayCard - * @extends BI.MultiDateCard +BI.IntervalSliderLabel.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.interval_slider_label", BI.IntervalSliderLabel);/** + * Created by zcf on 2017/3/1. + * 万恶的IEEE-754 + * 使用字符串精确计算含小数加法、减法、乘法和10的指数倍除法,支持负数 */ -BI.DayCard = BI.inherit(BI.MultiDateCard, { - +BI.AccurateCalculationModel = BI.inherit(BI.Widget, { _defaultConfig: function () { - return $.extend(BI.DayCard.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-daycard' - }); + return BI.extend(BI.AccurateCalculationModel.superclass._defaultConfig.apply(this, arguments), { + baseCls: "" + }) }, _init: function () { - BI.DayCard.superclass._init.apply(this, arguments); + BI.AccurateCalculationModel.superclass._init.apply(this, arguments); }, - dateConfig: function () { - return [{ - isEditorExist: true, - selected: true, - text: BI.i18nText("BI-Multi_Date_Day_Prev"), - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV - }, - { - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Day_Next"), - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER - }, - { - isEditorExist: false, - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY, - text: BI.i18nText("BI-Multi_Date_Today") - }]; + _getMagnitude: function (n) { + var magnitude = "1"; + for (var i = 0; i < n; i++) { + magnitude += "0"; + } + return BI.parseInt(magnitude); }, - defaultSelectedItem: function () { - return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV - } -}); -BI.DayCard.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.daycard', BI.DayCard); -/** - * 普通控件 - * - * @class BI.MonthCard - * @extends BI.MultiDateCard - */ -BI.MonthCard = BI.inherit(BI.MultiDateCard, { - _defaultConfig: function () { - return $.extend(BI.MonthCard.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-monthcard' - }); + _formatDecimal: function (stringNumber1, stringNumber2) { + if (stringNumber1.numDecimalLength === stringNumber2.numDecimalLength) { + return; + } + var magnitudeDiff = stringNumber1.numDecimalLength - stringNumber2.numDecimalLength; + if (magnitudeDiff > 0) { + var needAddZero = stringNumber2 + } else { + var needAddZero = stringNumber1; + magnitudeDiff = (0 - magnitudeDiff); + } + for (var i = 0; i < magnitudeDiff; i++) { + if (needAddZero.numDecimal === "0" && i === 0) { + continue + } + needAddZero.numDecimal += "0" + } }, - _init: function () { - BI.MonthCard.superclass._init.apply(this, arguments); + _stringNumberFactory: function (num) { + var strNum = num.toString(); + var numStrArray = strNum.split("."); + var numInteger = numStrArray[0]; + if (numStrArray.length === 1) { + var numDecimal = "0"; + var numDecimalLength = 0; + } else { + var numDecimal = numStrArray[1]; + var numDecimalLength = numStrArray[1].length; + } + return { + "numInteger": numInteger, + "numDecimal": numDecimal, + "numDecimalLength": numDecimalLength + } }, - dateConfig: function () { - return [{ - selected: true, - isEditorExist: true, - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV, - text: BI.i18nText("BI-Multi_Date_Month_Prev") - }, - { - isEditorExist: true, - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER, - text: BI.i18nText("BI-Multi_Date_Month_Next") - }, - { - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN, - isEditorExist: false, - text: BI.i18nText("BI-Multi_Date_Month_Begin") - }, - { - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END, - isEditorExist: false, - text: BI.i18nText("BI-Multi_Date_Month_End") - }]; + _accurateSubtraction: function (num1, num2) {//num1-num2 && num1>num2 + var stringNumber1 = this._stringNumberFactory(num1); + var stringNumber2 = this._stringNumberFactory(num2); + //整数部分计算 + var integerResult = BI.parseInt(stringNumber1.numInteger) - BI.parseInt(stringNumber2.numInteger); + //小数部分 + this._formatDecimal(stringNumber1, stringNumber2); + var decimalMaxLength = getDecimalMaxLength(stringNumber1, stringNumber2); + + if (BI.parseInt(stringNumber1.numDecimal) >= BI.parseInt(stringNumber2.numDecimal)) { + var decimalResultTemp = (BI.parseInt(stringNumber1.numDecimal) - BI.parseInt(stringNumber2.numDecimal)).toString(); + var decimalResult = addZero(decimalResultTemp, decimalMaxLength); + } else {//否则借位 + integerResult--; + var borrow = this._getMagnitude(decimalMaxLength); + var decimalResultTemp = (borrow + BI.parseInt(stringNumber1.numDecimal) - BI.parseInt(stringNumber2.numDecimal)).toString(); + var decimalResult = addZero(decimalResultTemp, decimalMaxLength); + } + var result = integerResult + "." + decimalResult; + return BI.parseFloat(result); + + function getDecimalMaxLength(num1, num2) { + if (num1.numDecimal.length >= num2.numDecimal.length) { + return num1.numDecimal.length + } + return num2.numDecimal.length + } + + function addZero(resultTemp, length) { + var diff = length - resultTemp.length; + for (var i = 0; i < diff; i++) { + resultTemp = "0" + resultTemp; + } + return resultTemp + } }, - defaultSelectedItem: function () { - return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV; - } -}); -BI.MonthCard.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.monthcard', BI.MonthCard); -/** - * 日期控件 - * @class BI.MultiDatePopup - * @extends BI.Widget - */ -BI.MultiDatePopup = BI.inherit(BI.Widget, { - constants: { - tabHeight: 30, - tabWidth: 42, - titleHeight: 27, - itemHeight: 30, - triggerHeight: 24, - buttonWidth: 90, - buttonHeight: 25, - cardHeight: 229, - cardWidth: 270, - popupHeight: 259, - popupWidth: 270, - comboAdjustHeight: 1, - ymdWidth: 58, - lgap: 2, - border: 1 + _accurateAddition: function (num1, num2) {//加法结合律 + var stringNumber1 = this._stringNumberFactory(num1); + var stringNumber2 = this._stringNumberFactory(num2); + //整数部分计算 + var integerResult = BI.parseInt(stringNumber1.numInteger) + BI.parseInt(stringNumber2.numInteger); + //小数部分 + this._formatDecimal(stringNumber1, stringNumber2); + + var decimalResult = (BI.parseInt(stringNumber1.numDecimal) + BI.parseInt(stringNumber2.numDecimal)).toString(); + + if (decimalResult !== "0") { + if (decimalResult.length <= stringNumber1.numDecimal.length) { + decimalResult = addZero(decimalResult, stringNumber1.numDecimal.length) + } else { + integerResult++;//进一 + decimalResult = decimalResult.slice(1); + } + } + var result = integerResult + "." + decimalResult; + return BI.parseFloat(result); + + function addZero(resultTemp, length) { + var diff = length - resultTemp.length; + for (var i = 0; i < diff; i++) { + resultTemp = "0" + resultTemp; + } + return resultTemp + } }, - _defaultConfig: function () { - return BI.extend(BI.MultiDatePopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-popup', - width: 268, - height: 260 - }); + + _accurateMultiplication: function (num1, num2) {//乘法分配律 + var stringNumber1 = this._stringNumberFactory(num1); + var stringNumber2 = this._stringNumberFactory(num2); + //整数部分计算 + var integerResult = BI.parseInt(stringNumber1.numInteger) * BI.parseInt(stringNumber2.numInteger); + //num1的小数和num2的整数 + var dec1Int2 = this._accurateDivisionTenExponent(BI.parseInt(stringNumber1.numDecimal) * BI.parseInt(stringNumber2.numInteger), stringNumber1.numDecimalLength); + //num1的整数和num2的小数 + var int1dec2 = this._accurateDivisionTenExponent(BI.parseInt(stringNumber1.numInteger) * BI.parseInt(stringNumber2.numDecimal), stringNumber2.numDecimalLength); + //小数*小数 + var dec1dec2 = this._accurateDivisionTenExponent(BI.parseInt(stringNumber1.numDecimal) * BI.parseInt(stringNumber2.numDecimal), (stringNumber1.numDecimalLength + stringNumber2.numDecimalLength)); + + return this._accurateAddition(this._accurateAddition(this._accurateAddition(integerResult, dec1Int2), int1dec2), dec1dec2); }, - _init: function () { - BI.MultiDatePopup.superclass._init.apply(this, arguments); - var self = this, opts = this.options; - this.storeValue = ""; - this.textButton = BI.createWidget({ - type: 'bi.text_button', - forceCenter: true, - cls: 'bi-multidate-popup-label bi-border-left bi-border-right bi-border-top', - shadow: true, - text: BI.i18nText("BI-Multi_Date_Today") - }); - this.textButton.on(BI.TextButton.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE); + + _accurateDivisionTenExponent: function (num, n) {// num/10^n && n>0 + var stringNumber = this._stringNumberFactory(num); + if (stringNumber.numInteger.length > n) { + var integerResult = stringNumber.numInteger.slice(0, (stringNumber.numInteger.length - n)); + var partDecimalResult = stringNumber.numInteger.slice(-n); + } else { + var integerResult = "0"; + var partDecimalResult = addZero(stringNumber.numInteger, n); + } + var result = integerResult + "." + partDecimalResult + stringNumber.numDecimal; + return BI.parseFloat(result); + + function addZero(resultTemp, length) { + var diff = length - resultTemp.length; + for (var i = 0; i < diff; i++) { + resultTemp = "0" + resultTemp; + } + return resultTemp + } + }, + + accurateSubtraction: function (num1, num2) { + if (num1 >= 0 && num2 >= 0) { + if (num1 >= num2) { + return this._accurateSubtraction(num1, num2) + } + return -this._accurateSubtraction(num2, num1) + } + if (num1 >= 0 && num2 < 0) { + return this._accurateAddition(num1, -num2) + } + if (num1 < 0 && num2 >= 0) { + return -this._accurateAddition(-num1, num2) + } + if (num1 < 0 && num2 < 0) { + if (num1 >= num2) { + return this._accurateSubtraction(-num2, -num1) + } + return this._accurateSubtraction(-num1, -num2) + } + }, + + accurateAddition: function (num1, num2) { + if (num1 >= 0 && num2 >= 0) { + return this._accurateAddition(num1, num2) + } + if (num1 >= 0 && num2 < 0) { + return this.accurateSubtraction(num1, -num2) + } + if (num1 < 0 && num2 >= 0) { + return this.accurateSubtraction(num2, -num1) + } + if (num1 < 0 && num2 < 0) { + return -this._accurateAddition(-num1, -num2) + } + }, + + accurateMultiplication: function (num1, num2) { + if (num1 >= 0 && num2 >= 0) { + return this._accurateMultiplication(num1, num2) + } + if (num1 >= 0 && num2 < 0) { + return -this._accurateMultiplication(num1, -num2) + } + if (num1 < 0 && num2 >= 0) { + return -this._accurateMultiplication(-num1, num2) + } + if (num1 < 0 && num2 < 0) { + return this._accurateMultiplication(-num1, -num2) + } + }, + + accurateDivisionTenExponent: function (num1, n) { + if (num1 >= 0) { + return this._accurateDivisionTenExponent(num1, n); + } + return -this._accurateDivisionTenExponent(-num1, n); + } +});/** + * 月份下拉框 + * + * 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: 25 }); - this.clearButton = BI.createWidget({ - type: "bi.text_button", - forceCenter: true, - cls: 'bi-multidate-popup-button bi-border-top', - shadow: true, - text: BI.i18nText("BI-Basic_Clear") + }, + _init: function () { + BI.MonthCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.month_trigger" }); - this.clearButton.on(BI.TextButton.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE); + + 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.okButton = BI.createWidget({ - type: "bi.text_button", - forceCenter: true, - cls: 'bi-multidate-popup-button bi-border-top', - shadow: true, - text: BI.i18nText("BI-Basic_OK") + this.trigger.on(BI.MonthTrigger.EVENT_FOCUS, function () { + self.storeValue = this.getKey(); }); - this.okButton.on(BI.TextButton.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE); + this.trigger.on(BI.MonthTrigger.EVENT_START, function () { + self.combo.hideView(); }); - this.dateTab = BI.createWidget({ - type: 'bi.tab', - tab: { - cls: "bi-multidate-popup-tab bi-border-bottom", - height: this.constants.tabHeight, - items: BI.createItems([{ - text: BI.i18nText("BI-Multi_Date_YMD"), - value: BI.MultiDateCombo.MULTI_DATE_YMD_CARD, - width: this.constants.ymdWidth - }, { - text: BI.i18nText("BI-Multi_Date_Year"), - value: BI.MultiDateCombo.MULTI_DATE_YEAR_CARD - }, { - text: BI.i18nText("BI-Multi_Date_Quarter"), - value: BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD - }, { - text: BI.i18nText("BI-Multi_Date_Month"), - value: BI.MultiDateCombo.MULTI_DATE_MONTH_CARD - }, { - text: BI.i18nText("BI-Multi_Date_Week"), - value: BI.MultiDateCombo.MULTI_DATE_WEEK_CARD - }, { - text: BI.i18nText("BI-Multi_Date_Day"), - value: BI.MultiDateCombo.MULTI_DATE_DAY_CARD - }], { - width: this.constants.tabWidth, - textAlign: "center", - height: this.constants.itemHeight, - cls: 'bi-multidate-popup-item bi-list-item-active' - }), - layouts: [{ - type: 'bi.left' - }] - }, - cardCreator: function (v) { - switch (v) { - case BI.MultiDateCombo.MULTI_DATE_YMD_CARD: - self.ymd = BI.createWidget({ - type: "bi.date_calendar_popup", - min: self.options.min, - max: self.options.max - }); - self.ymd.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE); - }); - return self.ymd; - case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD: - self.year = BI.createWidget({ - type: "bi.yearcard" - }); - self.year.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { - self._setInnerValue(self.year, v); - }); - return self.year; - case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD: - self.quarter = BI.createWidget({ - type: 'bi.quartercard' - }); - self.quarter.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { - self._setInnerValue(self.quarter, v); - }); - return self.quarter; - case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD: - self.month = BI.createWidget({ - type: 'bi.monthcard' - }); - self.month.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { - self._setInnerValue(self.month, v); - }); - return self.month; - case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD: - self.week = BI.createWidget({ - type: 'bi.weekcard' - }); - self.week.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { - self._setInnerValue(self.week, v); - }); - return self.week; - case BI.MultiDateCombo.MULTI_DATE_DAY_CARD: - self.day = BI.createWidget({ - type: 'bi.daycard' - }); - self.day.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { - self._setInnerValue(self.day, v); - }); - return self.day; - } + this.trigger.on(BI.MonthTrigger.EVENT_STOP, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); } }); - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); - this.cur = BI.MultiDateCombo.MULTI_DATE_YMD_CARD; - this.dateTab.on(BI.Tab.EVENT_CHANGE, function () { - var v = self.dateTab.getSelect(); - switch (v) { - case BI.MultiDateCombo.MULTI_DATE_YMD_CARD: - var date = this.getTab(self.cur).getCalculationValue(); - self.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth(), - day: date.getDate() - }); - self._setInnerValue(self.ymd); - break; - case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD: - self.year.setValue(self.storeValue); - self._setInnerValue(self.year); - break; - case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD: - self.quarter.setValue(self.storeValue); - self._setInnerValue(self.quarter); - break; - case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD: - self.month.setValue(self.storeValue); - self._setInnerValue(self.month); - break; - case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD: - self.week.setValue(self.storeValue); - self._setInnerValue(self.week); - break; - case BI.MultiDateCombo.MULTI_DATE_DAY_CARD: - self.day.setValue(self.storeValue); - self._setInnerValue(self.day); - break; - } - self.cur = v; + + this.popup = BI.createWidget({ + type: "bi.month_popup", + behaviors: o.behaviors }); - this.dateButton = BI.createWidget({ - type: "bi.grid", - items: [[this.clearButton, this.textButton, this.okButton]] + this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); }); - BI.createWidget({ + + this.combo = BI.createWidget({ + type: "bi.combo", element: this, - type: "bi.vtape", - items: [{ - el: this.dateTab - }, { - el: this.dateButton, - height: 30 - }] + 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); }); }, - _setInnerValue: function (obj) { - if (this.dateTab.getSelect() === BI.MultiDateCombo.MULTI_DATE_YMD_CARD) { - this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); - this.textButton.setEnable(true); - } else { - var date = obj.getCalculationValue(); - date = date.print("%Y-%x-%e"); - this.textButton.setValue(date); - this.textButton.setEnable(false); - } - }, + setValue: function (v) { - this.storeValue = v; - var self = this, date; - var type, value; - if (BI.isNotNull(v)) { - type = v.type || BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_CALENDAR; - value = v.value; - if (BI.isNull(value)) { - value = v; - } - } - switch (type) { - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YEAR_CARD); - this.year.setValue({type: type, value: value}); - this.cur = BI.MultiDateCombo.MULTI_DATE_YEAR_CARD; - self._setInnerValue(this.year); - break; - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD); - this.cur = BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD; - this.quarter.setValue({type: type, value: value}); - self._setInnerValue(this.quarter); - break; - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_MONTH_CARD); - this.cur = BI.MultiDateCombo.MULTI_DATE_MONTH_CARD; - this.month.setValue({type: type, value: value}); - self._setInnerValue(this.month); - break; - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_WEEK_CARD); - this.cur = BI.MultiDateCombo.MULTI_DATE_WEEK_CARD; - this.week.setValue({type: type, value: value}); - self._setInnerValue(this.week); - break; - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: - case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_DAY_CARD); - this.cur = BI.MultiDateCombo.MULTI_DATE_DAY_CARD; - this.day.setValue({type: type, value: value}); - self._setInnerValue(this.day); - break; - default: - if (BI.isNull(value) || BI.isEmptyObject(value)) { - var date = new Date(); - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth(), - day: date.getDate() - }); - this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); - } else { - this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); - this.ymd.setValue(value); - this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); - } - this.textButton.setEnable(true); - break; - } + this.trigger.setValue(v); + this.popup.setValue(v); }, + getValue: function () { - var tab = this.dateTab.getSelect(); - switch (tab) { - case BI.MultiDateCombo.MULTI_DATE_YMD_CARD: - return this.ymd.getValue(); - case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD: - return this.year.getValue(); - case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD: - return this.quarter.getValue(); - case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD: - return this.month.getValue(); - case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD: - return this.week.getValue(); - case BI.MultiDateCombo.MULTI_DATE_DAY_CARD: - return this.day.getValue(); - } + return this.popup.getValue(); } }); -BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; -BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; -BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; -BI.MultiDatePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; -BI.shortcut('bi.multidate_popup', BI.MultiDatePopup); -/** - * 普通控件 + +BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.month_combo', BI.MonthCombo);/** + * 月份展示面板 * - * @class BI.QuarterCard - * @extends BI.MultiDateCard + * Created by GUY on 2015/9/2. + * @class BI.MonthPopup + * @extends BI.Trigger */ -BI.QuarterCard = BI.inherit(BI.MultiDateCard, { +BI.MonthPopup = BI.inherit(BI.Widget, { _defaultConfig: function () { - return $.extend(BI.QuarterCard.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-quartercard' + return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-month-popup", + behaviors: {} }); }, _init: function () { - BI.QuarterCard.superclass._init.apply(this, arguments); - }, + BI.MonthPopup.superclass._init.apply(this, arguments); + var self = this, o = this.options; - dateConfig: function () { - return [{ - selected: true, - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV, - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Quarter_Prev") - }, - { - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER, - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Quarter_Next") - }, - { - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN, - isEditorExist: false, - text: BI.i18nText("BI-Multi_Date_Quarter_Begin") - }, - { - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END, - isEditorExist: false, - text: BI.i18nText("BI-Multi_Date_Quarter_End") + //纵向排列月 + var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; + var items = []; + items.push(month.slice(0, 2)); + items.push(month.slice(2, 4)); + items.push(month.slice(4, 6)); + items.push(month.slice(6, 8)); + items.push(month.slice(8, 10)); + items.push(month.slice(10, 12)); + items = BI.map(items, function (i, item) { + return BI.map(item, function (j, td) { + return { + type: "bi.text_item", + cls: "bi-list-item-active", + textAlign: "center", + whiteSpace: "nowrap", + once: false, + forceSelected: true, + height: 23, + width: 38, + value: td, + text: td + 1 + }; + }); + }); + + this.month = BI.createWidget({ + type: "bi.button_group", + element: this, + behaviors: o.behaviors, + items: BI.createItems(items, {}), + layouts: [BI.LogicFactory.createLogic("table", BI.extend({ + dynamic: true + }, { + columns: 2, + rows: 6, + columnSize: [1 / 2, 1 / 2], + rowSize: 25 + })), { + type: "bi.center_adapt", + vgap: 1, + hgap: 2 }] + }); + + this.month.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); + } + }) }, - defaultSelectedItem: function () { - return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV; + getValue: function () { + return this.month.getValue()[0]; + }, + + setValue: function (v) { + this.month.setValue([v]); } }); -BI.QuarterCard.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.quartercard', BI.QuarterCard); -/** - * 普通控件 +BI.MonthPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.month_popup", BI.MonthPopup);/** + * 月份trigger * - * @class BI.MultiDateSegment - * @extends BI.Single + * Created by GUY on 2015/8/21. + * @class BI.MonthTrigger + * @extends BI.Trigger */ -BI.MultiDateSegment = BI.inherit(BI.Single, { - constants: { - itemHeight: 24, - maxGap: 15, - minGap: 10, - textWidth: 30, - defaultEditorValue: "1" +BI.MonthTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + vgap: 2, + errorText: BI.i18nText("BI-Month_Trigger_Error_Text") }, _defaultConfig: function () { - return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-segment', - text: "", - width: 130, - height: 30, - isEditorExist: true, - selected: false, - defaultEditorValue: "1" + return BI.extend(BI.MonthTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-month-trigger bi-border", + height: 24 }); }, - _init: function () { - BI.MultiDateSegment.superclass._init.apply(this, arguments); - var self = this, opts = this.options; - this.radio = BI.createWidget({ - type: "bi.radio", - selected: opts.selected - }); - this.radio.on(BI.Controller.EVENT_CHANGE, function (v) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.textEditor = BI.createWidget({ - type: 'bi.text_editor', - value: this.constants.defaultEditorValue, - title: function () { - return self.textEditor.getValue(); - }, - tipType: "success", - cls: 'bi-multidate-editor', - width: this.constants.textWidth, - height: this.constants.itemHeight + 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: c.errorText }); - this.textEditor.on(BI.Controller.EVENT_CHANGE, function (v) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { + self.fireEvent(BI.MonthTrigger.EVENT_FOCUS); }); - this.text = BI.createWidget({ - type: "bi.label", - textAlign: "left", - cls: 'bi-multidate-normal-label', - text: opts.text, - height: this.constants.itemHeight + this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + self.fireEvent(BI.MonthTrigger.EVENT_CHANGE); }); - this._createSegment(); - }, - _createSegment: function () { - if (this.options.isEditorExist === true) { - return BI.createWidget({ - element: this, - type: 'bi.left', - items: [{ + 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.center_adapt", - items: [this.radio], - height: this.constants.itemHeight + type: "bi.text_button", + text: BI.i18nText("BI-Multi_Date_Month"), + baseCls: "bi-trigger-month-text", + width: o.height }, - lgap: 0 - }, - { - el: { - type: "bi.center_adapt", - items: [this.textEditor], - widgetName: 'textEditor' - }, - lgap: this.constants.maxGap + width: o.height + }, { + el: { + type: "bi.trigger_icon_button", + width: o.height }, - { - el: this.text, - lgap: this.constants.minGap - }] - }); - } - return BI.createWidget({ - element: this, - type: 'bi.left', - items: [{ - el: { - type: "bi.center_adapt", - items: [this.radio], - height: this.constants.itemHeight - }, - lgap: 0 - }, - { - el: this.text, - lgap: this.constants.maxGap - }] - }) + width: o.height + } + ] + }); }, - setSelected: function (v) { - if (BI.isNotNull(this.radio)) { - this.radio.setSelected(v); - this.textEditor.setEnable(v); + 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(""); }, - isSelected: function () { - return this.radio.isSelected(); + getKey: function () { + return this.editor.getValue() | 0; }, getValue: function () { - return this.options.value; - }, - getInputValue: function () { - return this.textEditor.getValue() | 0; - }, - setInputValue: function (v) { - this.textEditor.setValue(v); - }, - isEditorExist: function () { - return this.options.isEditorExist; + return this.editor.getValue() - 1; } }); -BI.MultiDateSegment.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.multidate_segment', BI.MultiDateSegment);/** +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);/** * 普通控件 * - * @class BI.WeekCard - * @extends BI.MultiDateCard + * @class BI.MultiDateCard + * @extends BI.Widget + * @abstract */ -BI.WeekCard = BI.inherit(BI.MultiDateCard, { - _defaultConfig: function () { - return $.extend(BI.WeekCard.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-weekcard' - }); - }, - - _init: function () { - BI.WeekCard.superclass._init.apply(this, arguments); - }, +BI.MultiDateCard = BI.inherit(BI.Widget, { - dateConfig: function () { - return [{ - selected: true, - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Week_Prev"), - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV - }, - { - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Week_Next"), - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER - }]; + constants: { + lgap: 80, + itemHeight: 35, + defaultEditorValue: "1" }, - defaultSelectedItem: function () { - return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV; - } -}); -BI.WeekCard.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.weekcard', BI.WeekCard); -/** - * 普通控件 - * - * @class BI.YearCard - * @extends BI.MultiDateCard - */ -BI.YearCard = BI.inherit(BI.MultiDateCard, { _defaultConfig: function () { - return $.extend(BI.YearCard.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multidate-yearcard' - }); - }, - - _init: function () { - BI.YearCard.superclass._init.apply(this, arguments); + return $.extend(BI.MultiDateCard.superclass._defaultConfig.apply(this, arguments), {}); }, dateConfig: function () { - return [{ - selected: true, - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Year_Prev"), - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV - }, - { - isEditorExist: true, - text: BI.i18nText("BI-Multi_Date_Year_Next"), - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER - }, - { - isEditorExist: false, - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN, - text: BI.i18nText("BI-Multi_Date_Year_Begin") - }, - { - isEditorExist: false, - value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END, - text: BI.i18nText("BI-Multi_Date_Year_End") - }] + }, defaultSelectedItem: function () { - return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV; - } -}); -BI.YearCard.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.yearcard', BI.YearCard); -/** - * @class BI.MultiLayerSelectTreeCombo - * @extends BI.Widget - */ -BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multilayer_select_tree-combo", - isDefaultInit: false, - height: 30, - text: "", - items: [] - }); }, _init: function () { - BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; + BI.MultiDateCard.superclass._init.apply(this, arguments); + var self = this, opts = this.options; - this.trigger = BI.createWidget({ - type: "bi.single_tree_trigger", - text: o.text, - height: o.height, - items: o.items + this.label = BI.createWidget({ + type: 'bi.label', + height: this.constants.itemHeight, + textAlign: "left", + text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"), + cls: 'bi-multidate-inner-label bi-tips' }); - - this.popup = BI.createWidget({ - type: "bi.multilayer_select_tree_popup", - isDefaultInit: o.isDefaultInit, - items: o.items + this.radioGroup = BI.createWidget({ + type: "bi.button_group", + chooseType: 0, + items: BI.createItems(this.dateConfig(), { + type: 'bi.multidate_segment', + height: this.constants.itemHeight + }), + layouts: [{ + type: "bi.vertical" + }] }); - this.combo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup + this.radioGroup.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CONFIRM) { + self.fireEvent(BI.MultiDateCard.EVENT_CHANGE); } }); - - this.combo.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + this.radioGroup.on(BI.ButtonGroup.EVENT_CHANGE, function () { + self.setValue(self.getValue()); + self.fireEvent(BI.MultiDateCard.EVENT_CHANGE); }); - - this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); - self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE); + BI.createWidget({ + element: this, + type: 'bi.center_adapt', + lgap: this.constants.lgap, + items: [{ + type: 'bi.vertical', + items: [this.label, this.radioGroup] + }] }); }, - setValue: function (v) { - v = BI.isArray(v) ? v : [v]; - this.trigger.setValue(v); - this.popup.setValue(v); + getValue: function () { + var button = this.radioGroup.getSelectedButtons()[0]; + var type = button.getValue(), value = button.getInputValue(); + return { + type: type, + value: value + } }, - getValue: function () { - return this.popup.getValue(); + _isTypeAvaliable: function (type) { + var res = false; + BI.find(this.dateConfig(), function (i, item) { + if (item.value === type) { + res = true; + return true; + } + }); + return res; }, - populate: function (items) { - this.combo.populate(items); + setValue: function (v) { + var self = this; + if (BI.isNotNull(v) && this._isTypeAvaliable(v.type)) { + this.radioGroup.setValue(v.type); + BI.each(this.radioGroup.getAllButtons(), function (i, button) { + if (button.isEditorExist() === true && button.isSelected()) { + button.setInputValue(v.value); + } else { + button.setInputValue(self.constants.defaultEditorValue); + } + }); + } else { + this.radioGroup.setValue(this.defaultSelectedItem()); + BI.each(this.radioGroup.getAllButtons(), function (i, button) { + button.setInputValue(self.constants.defaultEditorValue); + }); + } + }, + + getCalculationValue: function () { + var valueObject = this.getValue(); + var type = valueObject.type, value = valueObject.value; + switch (type) { + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: + return new Date().getOffsetDate(-1 * value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: + return new Date().getOffsetDate(value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: + return new Date(); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: + return new Date().getBeforeMultiMonth(value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: + return new Date().getAfterMultiMonth(value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: + return new Date(new Date().getFullYear(), new Date().getMonth(), 1); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: + return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate()); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: + return new Date().getBeforeMulQuarter(value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: + return new Date().getAfterMulQuarter(value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: + return new Date().getQuarterStartDate(); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: + return new Date().getQuarterEndDate(); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: + return new Date().getOffsetDate(-7 * value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: + return new Date().getOffsetDate(7 * value); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: + return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate()); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: + return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate()); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: + return new Date(new Date().getFullYear(), 0, 1); + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: + return new Date(new Date().getFullYear(), 11, 31); + } } }); -BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** - * guy - * 二级树 - * @class BI.MultiLayerSelectLevelTree - * @extends BI.Select +BI.MultiDateCard.EVENT_CHANGE = "EVENT_CHANGE"; +/** + * 日期控件 + * @class BI.MultiDateCombo + * @extends BI.Widget */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiDateCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 259, + popupWidth: 270, + comboAdjustHeight: 1, + border: 1, + DATE_MIN_VALUE: "1900-01-01", + DATE_MAX_VALUE: "2099-12-31" + }, _defaultConfig: function () { - return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multilayer-select-level-tree", - isDefaultInit: false, - items: [], - itemsCreator: BI.emptyFn - }) + return BI.extend(BI.MultiDateCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-combo bi-border', + height: 24 + }); }, - _init: function () { - BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); - - this.initTree(this.options.items); - }, - - _formatItems: function (nodes, layer) { - var self = this; - BI.each(nodes, function (i, node) { - var extend = {}; - node.layer = layer; - if (!BI.isKey(node.id)) { - node.id = BI.UUID(); + BI.MultiDateCombo.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + this.storeTriggerValue = ""; + var date = new Date(); + this.storeValue = null; + this.trigger = BI.createWidget({ + type: 'bi.date_trigger', + min: this.constants.DATE_MIN_VALUE, + max: this.constants.DATE_MAX_VALUE + }); + this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function () { + if (self.combo.isViewVisible()) { + self.combo.hideView(); } - if (node.isParent === true || BI.isNotEmptyArray(node.children)) { - switch (i) { - case 0 : - extend.type = "bi.multilayer_select_tree_first_plus_group_node"; - break; - case nodes.length - 1 : - extend.type = "bi.multilayer_select_tree_last_plus_group_node"; - break; - default : - extend.type = "bi.multilayer_select_tree_mid_plus_group_node"; - break; - } - BI.defaults(node, extend); - - self._formatItems(node.children, layer + 1); - } else { - switch (i) { - case nodes.length - 1: - extend.type = "bi.multilayer_single_tree_last_tree_leaf_item"; - break; - default : - extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; - } - BI.defaults(node, extend); + }); + this.trigger.on(BI.DateTrigger.EVENT_STOP, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); } }); - return nodes; - }, - - _assertId: function (sNodes) { - BI.each(sNodes, function (i, node) { - node.id = node.id || BI.UUID(); + this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () { + self.combo.toggle(); }); - }, - - //构造树结构, - initTree: function (nodes) { - var self = this, o = this.options; - this.empty(); - this._assertId(nodes); - this.tree = BI.createWidget({ - type: "bi.custom_tree", - element: this, - expander: { - type: "bi.select_tree_expander", - isDefaultInit: o.isDefaultInit, - el: {}, - popup: { - type: "bi.custom_tree" - } - }, - - items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), - itemsCreator: o.itemsCreator, - - el: { - type: "bi.button_tree", - chooseType: BI.Selection.Single, - layouts: [{ - type: "bi.vertical" - }] + this.trigger.on(BI.DateTrigger.EVENT_FOCUS, function () { + self.storeTriggerValue = self.trigger.getKey(); + if (!self.combo.isViewVisible()) { + self.combo.showView(); } + self.fireEvent(BI.MultiDateCombo.EVENT_FOCUS); }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - if (type === BI.Events.CLICK) { - self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); - } + this.trigger.on(BI.DateTrigger.EVENT_ERROR, function () { + self.storeValue = { + year: date.getFullYear(), + month: date.getMonth() + }; + self.popup.setValue(); + self.fireEvent(BI.MultiDateCombo.EVENT_ERROR); + }); + this.trigger.on(BI.DateTrigger.EVENT_VALID, function () { + self.fireEvent(BI.MultiDateCombo.EVENT_VALID); + }); + this.trigger.on(BI.DateTrigger.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiDateCombo.EVENT_CHANGE); + }); + this.trigger.on(BI.DateTrigger.EVENT_CONFIRM, function () { + if (self.combo.isViewVisible()) { + return; + } + var dateStore = self.storeTriggerValue; + var dateObj = self.trigger.getKey(); + if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) { + self.storeValue = self.trigger.getValue(); + self.setValue(self.trigger.getValue()); + } else if (BI.isEmptyString(dateObj)) { + self.storeValue = null; + self.trigger.setValue(); + } + self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); + }); + this.popup = BI.createWidget({ + type: "bi.multidate_popup", + min: this.constants.DATE_MIN_VALUE, + max: this.constants.DATE_MAX_VALUE + }); + this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () { + self.setValue(); + self.combo.hideView(); + self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); + }); + this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () { + var date = new Date(); + self.setValue({ + year: date.getFullYear(), + month: date.getMonth(), + day: date.getDate() + }); + self.combo.hideView(); + self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); + }); + this.popup.on(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); + }); + this.popup.on(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + //self.fireEvent(BI.MultiDateCombo.EVENT_CHANGE); + self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); + }); + this.combo = BI.createWidget({ + type: 'bi.combo', + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: this.popup, + maxHeight: this.constants.popupHeight, + width: this.constants.popupWidth, + stopPropagation: false + } + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW); + }); + + var triggerBtn = BI.createWidget({ + type: "bi.icon_button", + cls: "bi-trigger-icon-button date-font", + width: 24, + height: 24 + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + this.changeIcon = BI.createWidget({ + type: "bi.icon_button", + cls: "bi-trigger-icon-button date-change-h-font", + width: 24, + height: 24 + }); + + + var leftPart = BI.createWidget({ + type: "bi.absolute", + items: [{ + el: this.combo, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: triggerBtn, + top: 0, + left: 0 + }] + }); + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [leftPart, { + el: this.changeIcon, + width: 30 + }], + ref: function (_ref) { + self.comboWrapper = _ref; + } }) }, - populate: function (nodes) { - this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); + _checkDynamicValue: function (v) { + var type = null; + if (BI.isNotNull(v)) { + type = v.type + } + switch (type) { + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: + this.changeIcon.setVisible(true); + this.comboWrapper.attr("items")[1].width = 30; + this.comboWrapper.resize(); + break; + default: + this.comboWrapper.attr("items")[1].width = 0; + this.comboWrapper.resize(); + this.changeIcon.setVisible(false); + break; + } }, setValue: function (v) { - this.tree.setValue(v); + this.storeValue = v; + this.popup.setValue(v); + this.trigger.setValue(v); + this._checkDynamicValue(v) }, - getValue: function () { - return this.tree.getValue(); + return this.storeValue; }, - - getAllLeaves: function () { - return this.tree.getAllLeaves(); + getKey: function () { + return this.trigger.getKey(); }, + hidePopupView: function () { + this.combo.hideView(); + } +}); +BI.shortcut('bi.multidate_combo', BI.MultiDateCombo); - getNodeById: function (id) { - return this.tree.getNodeById(id); - }, +BI.MultiDateCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiDateCombo.EVENT_FOCUS = "EVENT_FOCUS"; +BI.MultiDateCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiDateCombo.EVENT_VALID = "EVENT_VALID"; +BI.MultiDateCombo.EVENT_ERROR = "EVENT_ERROR"; +BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW = "BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW"; - getNodeByValue: function (id) { - return this.tree.getNodeByValue(id); - } +BI.extend(BI.MultiDateCombo, { + MULTI_DATE_YMD_CARD: 1, + MULTI_DATE_YEAR_CARD: 2, + MULTI_DATE_QUARTER_CARD: 3, + MULTI_DATE_MONTH_CARD: 4, + MULTI_DATE_WEEK_CARD: 5, + MULTI_DATE_DAY_CARD: 6 }); -BI.MultiLayerSelectLevelTree.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** - * Created by GUY on 2016/1/26. +BI.extend(BI.MultiDateCombo, { + DATE_TYPE: { + MULTI_DATE_YEAR_PREV: 1, + MULTI_DATE_YEAR_AFTER: 2, + MULTI_DATE_YEAR_BEGIN: 3, + MULTI_DATE_YEAR_END: 4, + MULTI_DATE_MONTH_PREV: 5, + MULTI_DATE_MONTH_AFTER: 6, + MULTI_DATE_MONTH_BEGIN: 7, + MULTI_DATE_MONTH_END: 8, + MULTI_DATE_QUARTER_PREV: 9, + MULTI_DATE_QUARTER_AFTER: 10, + MULTI_DATE_QUARTER_BEGIN: 11, + MULTI_DATE_QUARTER_END: 12, + MULTI_DATE_WEEK_PREV: 13, + MULTI_DATE_WEEK_AFTER: 14, + MULTI_DATE_DAY_PREV: 15, + MULTI_DATE_DAY_AFTER: 16, + MULTI_DATE_DAY_TODAY: 17, + MULTI_DATE_PARAM: 18, + MULTI_DATE_CALENDAR: 19, + YEAR_QUARTER: 20, + YEAR_MONTH: 21, + YEAR_WEEK: 22, + YEAR_DAY: 23, + MONTH_WEEK: 24, + MONTH_DAY: 25, + YEAR: 26, + SAME_PERIOD: 27, + LAST_SAME_PERIOD: 28 + } +}); +/** + * 普通控件 * - * @class BI.MultiLayerSelectTreePopup - * @extends BI.Pane + * @class BI.DayCard + * @extends BI.MultiDateCard */ - -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.DayCard = BI.inherit(BI.MultiDateCard, { _defaultConfig: function () { - return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multilayer-select-tree-popup", - tipText: BI.i18nText("BI-No_Selected_Item"), - isDefaultInit: false, - itemsCreator: BI.emptyFn, - items: [] + return $.extend(BI.DayCard.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-daycard' }); }, _init: function () { - BI.MultiLayerSelectTreePopup.superclass._init.apply(this, arguments); - - var self = this, o = this.options; + BI.DayCard.superclass._init.apply(this, arguments); + }, - this.tree = BI.createWidget({ - type: 'bi.multilayer_select_level_tree', - isDefaultInit: o.isDefaultInit, - items: o.items, - itemsCreator: o.itemsCreator - }); - - BI.createWidget({ - type: "bi.vertical", - scrolly: false, - scrollable: true, - element: this, - items: [this.tree] - }); - - this.tree.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - - this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); - }); - - this.check(); - }, - - getValue: function () { - return this.tree.getValue(); - }, - - setValue: function (v) { - v = BI.isArray(v) ? v : [v]; - this.tree.setValue(v); + dateConfig: function () { + return [{ + isEditorExist: true, + selected: true, + text: BI.i18nText("BI-Multi_Date_Day_Prev"), + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV + }, + { + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Day_Next"), + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER + }, + { + isEditorExist: false, + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY, + text: BI.i18nText("BI-Multi_Date_Today") + }]; }, - populate: function (items) { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); - this.tree.populate(items); + defaultSelectedItem: function () { + return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV } }); - -BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/** - * 加号表示的组节点 +BI.DayCard.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.daycard', BI.DayCard); +/** + * 普通控件 * - * Created by GUY on 2016/1/27. - * @class BI.MultiLayerSelectTreeFirstPlusGroupNode - * @extends BI.NodeButton + * @class BI.MonthCard + * @extends BI.MultiDateCard */ -BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { +BI.MonthCard = BI.inherit(BI.MultiDateCard, { _defaultConfig: function () { - var conf = BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active", - layer: 0,//第几层级 - id: "", - pId: "", - readonly: true, - open: false, - height: 25 - }) - }, - _init: function () { - BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.node = BI.createWidget({ - type: "bi.select_tree_first_plus_group_node", - cls: "bi-list-item-none", - stopPropagation: true, - logic: { - dynamic: true - }, - id: o.id, - pId: o.pId, - open: o.open, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py - }); - this.node.on(BI.Controller.EVENT_CHANGE, function (type) { - self.setSelected(self.isSelected()); - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - - var items = []; - BI.count(0, o.layer, function () { - items.push({ - type: "bi.layout", - cls: "base-line-conn-background", - width: 13, - height: o.height - }) + return $.extend(BI.MonthCard.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-monthcard' }); - items.push(this.node); - BI.createWidget({ - type: "bi.td", - element: this, - columnSize: BI.makeArray(o.layer, 13), - items: [items] - }) - }, - - isOnce: function () { - return true; - }, - - doRedMark: function () { - this.node.doRedMark.apply(this.node, arguments); }, - unRedMark: function () { - this.node.unRedMark.apply(this.node, arguments); - }, - - isSelected: function () { - return this.node.isSelected(); - }, - - setSelected: function (b) { - BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setSelected.apply(this, arguments); - this.node.setSelected(b); + _init: function () { + BI.MonthCard.superclass._init.apply(this, arguments); }, - doClick: function () { - BI.NodeButton.superclass.doClick.apply(this, arguments); - this.node.setSelected(this.isSelected()); + dateConfig: function () { + return [{ + selected: true, + isEditorExist: true, + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV, + text: BI.i18nText("BI-Multi_Date_Month_Prev") + }, + { + isEditorExist: true, + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER, + text: BI.i18nText("BI-Multi_Date_Month_Next") + }, + { + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN, + isEditorExist: false, + text: BI.i18nText("BI-Multi_Date_Month_Begin") + }, + { + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END, + isEditorExist: false, + text: BI.i18nText("BI-Multi_Date_Month_End") + }]; }, - setOpened: function (v) { - BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); - this.node.setOpened(v); + defaultSelectedItem: function () { + return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV; } }); - -BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode);/** - * 加号表示的组节点 - * - * Created by GUY on 2016/1/27. - * @class BI.MultiLayerSelectTreeLastPlusGroupNode - * @extends BI.NodeButton +BI.MonthCard.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.monthcard', BI.MonthCard); +/** + * 日期控件 + * @class BI.MultiDatePopup + * @extends BI.Widget */ -BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { +BI.MultiDatePopup = BI.inherit(BI.Widget, { + constants: { + tabHeight: 30, + tabWidth: 42, + titleHeight: 27, + itemHeight: 30, + triggerHeight: 24, + buttonWidth: 90, + buttonHeight: 25, + cardHeight: 229, + cardWidth: 270, + popupHeight: 259, + popupWidth: 270, + comboAdjustHeight: 1, + ymdWidth: 58, + lgap: 2, + border: 1 + }, _defaultConfig: function () { - var conf = BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - extraCls: "bi-multilayer-select-tree-last-plus-group-node bi-list-item-active", - layer: 0,//第几层级 - id: "", - pId: "", - readonly: true, - open: false, - height: 25 - }) + return BI.extend(BI.MultiDatePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-popup', + width: 268, + height: 260 + }); }, _init: function () { - BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.node = BI.createWidget({ - type: "bi.select_tree_last_plus_group_node", - cls: "bi-list-item-none", - stopPropagation: true, - logic: { - dynamic: true - }, - id: o.id, - pId: o.pId, - open: o.open, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py + BI.MultiDatePopup.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + this.storeValue = ""; + this.textButton = BI.createWidget({ + type: 'bi.text_button', + forceCenter: true, + cls: 'bi-multidate-popup-label bi-border-left bi-border-right bi-border-top', + shadow: true, + text: BI.i18nText("BI-Multi_Date_Today") }); - this.node.on(BI.Controller.EVENT_CHANGE, function (type) { - self.setSelected(self.isSelected()); - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + this.textButton.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE); }); - - var items = []; - BI.count(0, o.layer, function () { - items.push({ - type: "bi.layout", - cls: "base-line-conn-background", - width: 13, + this.clearButton = BI.createWidget({ + type: "bi.text_button", + forceCenter: true, + cls: 'bi-multidate-popup-button bi-border-top', + shadow: true, + text: BI.i18nText("BI-Basic_Clear") + }); + this.clearButton.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE); + }); + this.okButton = BI.createWidget({ + type: "bi.text_button", + forceCenter: true, + cls: 'bi-multidate-popup-button bi-border-top', + shadow: true, + text: BI.i18nText("BI-Basic_OK") + }); + this.okButton.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE); + }); + this.dateTab = BI.createWidget({ + type: 'bi.tab', + tab: { + cls: "bi-multidate-popup-tab bi-border-bottom", + height: this.constants.tabHeight, + items: BI.createItems([{ + text: BI.i18nText("BI-Multi_Date_YMD"), + value: BI.MultiDateCombo.MULTI_DATE_YMD_CARD, + width: this.constants.ymdWidth + }, { + text: BI.i18nText("BI-Multi_Date_Year"), + value: BI.MultiDateCombo.MULTI_DATE_YEAR_CARD + }, { + text: BI.i18nText("BI-Multi_Date_Quarter"), + value: BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD + }, { + text: BI.i18nText("BI-Multi_Date_Month"), + value: BI.MultiDateCombo.MULTI_DATE_MONTH_CARD + }, { + text: BI.i18nText("BI-Multi_Date_Week"), + value: BI.MultiDateCombo.MULTI_DATE_WEEK_CARD + }, { + text: BI.i18nText("BI-Multi_Date_Day"), + value: BI.MultiDateCombo.MULTI_DATE_DAY_CARD + }], { + width: this.constants.tabWidth, + textAlign: "center", + height: this.constants.itemHeight, + cls: 'bi-multidate-popup-item bi-list-item-active' + }), + layouts: [{ + type: 'bi.left' + }] + }, + cardCreator: function (v) { + switch (v) { + case BI.MultiDateCombo.MULTI_DATE_YMD_CARD: + self.ymd = BI.createWidget({ + type: "bi.date_calendar_popup", + min: self.options.min, + max: self.options.max + }); + self.ymd.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE); + }); + return self.ymd; + case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD: + self.year = BI.createWidget({ + type: "bi.yearcard" + }); + self.year.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { + self._setInnerValue(self.year, v); + }); + return self.year; + case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD: + self.quarter = BI.createWidget({ + type: 'bi.quartercard' + }); + self.quarter.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { + self._setInnerValue(self.quarter, v); + }); + return self.quarter; + case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD: + self.month = BI.createWidget({ + type: 'bi.monthcard' + }); + self.month.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { + self._setInnerValue(self.month, v); + }); + return self.month; + case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD: + self.week = BI.createWidget({ + type: 'bi.weekcard' + }); + self.week.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { + self._setInnerValue(self.week, v); + }); + return self.week; + case BI.MultiDateCombo.MULTI_DATE_DAY_CARD: + self.day = BI.createWidget({ + type: 'bi.daycard' + }); + self.day.on(BI.MultiDateCard.EVENT_CHANGE, function (v) { + self._setInnerValue(self.day, v); + }); + return self.day; + } + } + }); + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); + this.cur = BI.MultiDateCombo.MULTI_DATE_YMD_CARD; + this.dateTab.on(BI.Tab.EVENT_CHANGE, function () { + var v = self.dateTab.getSelect(); + switch (v) { + case BI.MultiDateCombo.MULTI_DATE_YMD_CARD: + var date = this.getTab(self.cur).getCalculationValue(); + self.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth(), + day: date.getDate() + }); + self._setInnerValue(self.ymd); + break; + case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD: + self.year.setValue(self.storeValue); + self._setInnerValue(self.year); + break; + case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD: + self.quarter.setValue(self.storeValue); + self._setInnerValue(self.quarter); + break; + case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD: + self.month.setValue(self.storeValue); + self._setInnerValue(self.month); + break; + case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD: + self.week.setValue(self.storeValue); + self._setInnerValue(self.week); + break; + case BI.MultiDateCombo.MULTI_DATE_DAY_CARD: + self.day.setValue(self.storeValue); + self._setInnerValue(self.day); + break; + } + self.cur = v; + }); + this.dateButton = BI.createWidget({ + type: "bi.grid", + items: [[this.clearButton, this.textButton, this.okButton]] + }); + BI.createWidget({ + element: this, + type: "bi.vtape", + items: [{ + el: this.dateTab + }, { + el: this.dateButton, + height: 30 + }] + }); + }, + _setInnerValue: function (obj) { + if (this.dateTab.getSelect() === BI.MultiDateCombo.MULTI_DATE_YMD_CARD) { + this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); + this.textButton.setEnable(true); + } else { + var date = obj.getCalculationValue(); + date = date.print("%Y-%x-%e"); + this.textButton.setValue(date); + this.textButton.setEnable(false); + } + }, + setValue: function (v) { + this.storeValue = v; + var self = this, date; + var type, value; + if (BI.isNotNull(v)) { + type = v.type || BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_CALENDAR; + value = v.value; + if (BI.isNull(value)) { + value = v; + } + } + switch (type) { + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YEAR_CARD); + this.year.setValue({type: type, value: value}); + this.cur = BI.MultiDateCombo.MULTI_DATE_YEAR_CARD; + self._setInnerValue(this.year); + break; + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD); + this.cur = BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD; + this.quarter.setValue({type: type, value: value}); + self._setInnerValue(this.quarter); + break; + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_MONTH_CARD); + this.cur = BI.MultiDateCombo.MULTI_DATE_MONTH_CARD; + this.month.setValue({type: type, value: value}); + self._setInnerValue(this.month); + break; + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_WEEK_CARD); + this.cur = BI.MultiDateCombo.MULTI_DATE_WEEK_CARD; + this.week.setValue({type: type, value: value}); + self._setInnerValue(this.week); + break; + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: + case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_DAY_CARD); + this.cur = BI.MultiDateCombo.MULTI_DATE_DAY_CARD; + this.day.setValue({type: type, value: value}); + self._setInnerValue(this.day); + break; + default: + if (BI.isNull(value) || BI.isEmptyObject(value)) { + var date = new Date(); + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth(), + day: date.getDate() + }); + this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); + } else { + this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); + this.ymd.setValue(value); + this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today")); + } + this.textButton.setEnable(true); + break; + } + }, + getValue: function () { + var tab = this.dateTab.getSelect(); + switch (tab) { + case BI.MultiDateCombo.MULTI_DATE_YMD_CARD: + return this.ymd.getValue(); + case BI.MultiDateCombo.MULTI_DATE_YEAR_CARD: + return this.year.getValue(); + case BI.MultiDateCombo.MULTI_DATE_QUARTER_CARD: + return this.quarter.getValue(); + case BI.MultiDateCombo.MULTI_DATE_MONTH_CARD: + return this.month.getValue(); + case BI.MultiDateCombo.MULTI_DATE_WEEK_CARD: + return this.week.getValue(); + case BI.MultiDateCombo.MULTI_DATE_DAY_CARD: + return this.day.getValue(); + } + } +}); +BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; +BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; +BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; +BI.MultiDatePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; +BI.shortcut('bi.multidate_popup', BI.MultiDatePopup); +/** + * 普通控件 + * + * @class BI.QuarterCard + * @extends BI.MultiDateCard + */ +BI.QuarterCard = BI.inherit(BI.MultiDateCard, { + + _defaultConfig: function () { + return $.extend(BI.QuarterCard.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-quartercard' + }); + }, + + _init: function () { + BI.QuarterCard.superclass._init.apply(this, arguments); + }, + + dateConfig: function () { + return [{ + selected: true, + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV, + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Quarter_Prev") + }, + { + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER, + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Quarter_Next") + }, + { + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN, + isEditorExist: false, + text: BI.i18nText("BI-Multi_Date_Quarter_Begin") + }, + { + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END, + isEditorExist: false, + text: BI.i18nText("BI-Multi_Date_Quarter_End") + }] + }, + + defaultSelectedItem: function () { + return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV; + } +}); +BI.QuarterCard.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.quartercard', BI.QuarterCard); +/** + * 普通控件 + * + * @class BI.MultiDateSegment + * @extends BI.Single + */ +BI.MultiDateSegment = BI.inherit(BI.Single, { + constants: { + itemHeight: 24, + maxGap: 15, + minGap: 10, + textWidth: 30, + defaultEditorValue: "1" + }, + + _defaultConfig: function () { + return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-segment', + text: "", + width: 130, + height: 30, + isEditorExist: true, + selected: false, + defaultEditorValue: "1" + }); + }, + + _init: function () { + BI.MultiDateSegment.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + this.radio = BI.createWidget({ + type: "bi.radio", + selected: opts.selected + }); + this.radio.on(BI.Controller.EVENT_CHANGE, function (v) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.textEditor = BI.createWidget({ + type: 'bi.text_editor', + value: this.constants.defaultEditorValue, + title: function () { + return self.textEditor.getValue(); + }, + tipType: "success", + cls: 'bi-multidate-editor', + width: this.constants.textWidth, + height: this.constants.itemHeight + }); + this.textEditor.on(BI.Controller.EVENT_CHANGE, function (v) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + cls: 'bi-multidate-normal-label', + text: opts.text, + height: this.constants.itemHeight + }); + this._createSegment(); + }, + _createSegment: function () { + if (this.options.isEditorExist === true) { + return BI.createWidget({ + element: this, + type: 'bi.left', + items: [{ + el: { + type: "bi.center_adapt", + items: [this.radio], + height: this.constants.itemHeight + }, + lgap: 0 + }, + { + el: { + type: "bi.center_adapt", + items: [this.textEditor], + widgetName: 'textEditor' + }, + lgap: this.constants.maxGap + }, + { + el: this.text, + lgap: this.constants.minGap + }] + }); + } + return BI.createWidget({ + element: this, + type: 'bi.left', + items: [{ + el: { + type: "bi.center_adapt", + items: [this.radio], + height: this.constants.itemHeight + }, + lgap: 0 + }, + { + el: this.text, + lgap: this.constants.maxGap + }] + }) + }, + setSelected: function (v) { + if (BI.isNotNull(this.radio)) { + this.radio.setSelected(v); + this.textEditor.setEnable(v); + } + }, + isSelected: function () { + return this.radio.isSelected(); + }, + getValue: function () { + return this.options.value; + }, + getInputValue: function () { + return this.textEditor.getValue() | 0; + }, + setInputValue: function (v) { + this.textEditor.setValue(v); + }, + isEditorExist: function () { + return this.options.isEditorExist; + } +}); +BI.MultiDateSegment.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multidate_segment', BI.MultiDateSegment);/** + * 普通控件 + * + * @class BI.WeekCard + * @extends BI.MultiDateCard + */ +BI.WeekCard = BI.inherit(BI.MultiDateCard, { + _defaultConfig: function () { + return $.extend(BI.WeekCard.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-weekcard' + }); + }, + + _init: function () { + BI.WeekCard.superclass._init.apply(this, arguments); + }, + + dateConfig: function () { + return [{ + selected: true, + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Week_Prev"), + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV + }, + { + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Week_Next"), + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER + }]; + }, + + defaultSelectedItem: function () { + return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV; + } +}); +BI.WeekCard.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.weekcard', BI.WeekCard); +/** + * 普通控件 + * + * @class BI.YearCard + * @extends BI.MultiDateCard + */ +BI.YearCard = BI.inherit(BI.MultiDateCard, { + _defaultConfig: function () { + return $.extend(BI.YearCard.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multidate-yearcard' + }); + }, + + _init: function () { + BI.YearCard.superclass._init.apply(this, arguments); + }, + + dateConfig: function () { + return [{ + selected: true, + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Year_Prev"), + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV + }, + { + isEditorExist: true, + text: BI.i18nText("BI-Multi_Date_Year_Next"), + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER + }, + { + isEditorExist: false, + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN, + text: BI.i18nText("BI-Multi_Date_Year_Begin") + }, + { + isEditorExist: false, + value: BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END, + text: BI.i18nText("BI-Multi_Date_Year_End") + }] + }, + + defaultSelectedItem: function () { + return BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV; + } +}); +BI.YearCard.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.yearcard', BI.YearCard); +/** + * @class BI.MultiLayerSelectTreeCombo + * @extends BI.Widget + */ +BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer_select_tree-combo", + isDefaultInit: false, + height: 30, + text: "", + items: [] + }); + }, + + _init: function () { + BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.single_tree_trigger", + text: o.text, + height: o.height, + items: o.items + }); + + this.popup = BI.createWidget({ + type: "bi.multilayer_select_tree_popup", + isDefaultInit: o.isDefaultInit, + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + + this.combo.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE); + }); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + populate: function (items) { + this.combo.populate(items); + } +}); +BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** + * guy + * 二级树 + * @class BI.MultiLayerSelectLevelTree + * @extends BI.Select + */ +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-select-level-tree", + isDefaultInit: false, + items: [], + itemsCreator: BI.emptyFn + }) + }, + + _init: function () { + BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + + this.initTree(this.options.items); + }, + + _formatItems: function (nodes, layer) { + var self = this; + BI.each(nodes, function (i, node) { + var extend = {}; + node.layer = layer; + if (!BI.isKey(node.id)) { + node.id = BI.UUID(); + } + if (node.isParent === true || BI.isNotEmptyArray(node.children)) { + switch (i) { + case 0 : + extend.type = "bi.multilayer_select_tree_first_plus_group_node"; + break; + case nodes.length - 1 : + extend.type = "bi.multilayer_select_tree_last_plus_group_node"; + break; + default : + extend.type = "bi.multilayer_select_tree_mid_plus_group_node"; + break; + } + BI.defaults(node, extend); + + self._formatItems(node.children, layer + 1); + } else { + switch (i) { + case nodes.length - 1: + extend.type = "bi.multilayer_single_tree_last_tree_leaf_item"; + break; + default : + extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; + } + BI.defaults(node, extend); + } + }); + return nodes; + }, + + _assertId: function (sNodes) { + BI.each(sNodes, function (i, node) { + node.id = node.id || BI.UUID(); + }); + }, + + //构造树结构, + initTree: function (nodes) { + var self = this, o = this.options; + this.empty(); + this._assertId(nodes); + this.tree = BI.createWidget({ + type: "bi.custom_tree", + element: this, + expander: { + type: "bi.select_tree_expander", + isDefaultInit: o.isDefaultInit, + el: {}, + popup: { + type: "bi.custom_tree" + } + }, + + items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + itemsCreator: o.itemsCreator, + + el: { + type: "bi.button_tree", + chooseType: BI.Selection.Single, + layouts: [{ + type: "bi.vertical" + }] + } + }); + this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); + } + }) + }, + + populate: function (nodes) { + this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); + }, + + setValue: function (v) { + this.tree.setValue(v); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + getAllLeaves: function () { + return this.tree.getAllLeaves(); + }, + + getNodeById: function (id) { + return this.tree.getNodeById(id); + }, + + getNodeByValue: function (id) { + return this.tree.getNodeByValue(id); + } +}); +BI.MultiLayerSelectLevelTree.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** + * Created by GUY on 2016/1/26. + * + * @class BI.MultiLayerSelectTreePopup + * @extends BI.Pane + */ + +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-select-tree-popup", + tipText: BI.i18nText("BI-No_Selected_Item"), + isDefaultInit: false, + itemsCreator: BI.emptyFn, + items: [] + }); + }, + + _init: function () { + BI.MultiLayerSelectTreePopup.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + this.tree = BI.createWidget({ + type: 'bi.multilayer_select_level_tree', + isDefaultInit: o.isDefaultInit, + items: o.items, + itemsCreator: o.itemsCreator + }); + + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + scrollable: true, + element: this, + items: [this.tree] + }); + + this.tree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); + }); + + this.check(); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.tree.setValue(v); + }, + + populate: function (items) { + BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); + this.tree.populate(items); + } +}); + +BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSelectTreeFirstPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active", + layer: 0,//第几层级 + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.select_tree_first_plus_group_node", + cls: "bi-list-item-none", + stopPropagation: true, + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + self.setSelected(self.isSelected()); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + isOnce: function () { + return true; + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + isSelected: function () { + return this.node.isSelected(); + }, + + setSelected: function (b) { + BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setSelected.apply(this, arguments); + this.node.setSelected(b); + }, + + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); + this.node.setOpened(v); + } +}); + +BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSelectTreeLastPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-select-tree-last-plus-group-node bi-list-item-active", + layer: 0,//第几层级 + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.select_tree_last_plus_group_node", + cls: "bi-list-item-none", + stopPropagation: true, + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + self.setSelected(self.isSelected()); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, height: o.height }) }); @@ -8329,194 +9505,550 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { }, _defaultConfig: function () { - return BI.extend(BI.MultiSelectCheckPane.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-select-check-pane bi-background", - items: [], + return BI.extend(BI.MultiSelectCheckPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-check-pane bi-background", + items: [], + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, + onClickContinueSelect: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectCheckPane.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.storeValue = {}; + this.display = BI.createWidget({ + type: 'bi.display_selected_list', + items: opts.items, + itemsCreator: function (op, callback) { + op = BI.extend(op || {}, { + selectedValues: self.storeValue.value + }); + if (self.storeValue.type === BI.Selection.Multi) { + callback({ + items: BI.map(self.storeValue.value, function (i, v) { + var txt = opts.valueFormatter(v) || v; + return { + text: txt, + value: v, + title: txt + } + }) + }); + return; + } + opts.itemsCreator(op, callback); + } + }); + + this.continueSelect = BI.createWidget({ + type: 'bi.text_button', + text: BI.i18nText('BI-Continue_Select'), + cls: 'multi-select-check-selected bi-high-light' + }); + + this.continueSelect.on(BI.TextButton.EVENT_CHANGE, function () { + opts.onClickContinueSelect(); + }); + + BI.createWidget({ + type: 'bi.vtape', + element: this, + items: [{ + height: this.constants.height, + el: { + type: 'bi.left', + cls: 'multi-select-continue-select', + items: [ + { + el: { + type: "bi.label", + text: BI.i18nText('BI-Selected_Data') + }, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }, + { + el: this.continueSelect, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }] + } + }, { + height: 'fill', + el: this.display + }] + }); + }, + + setValue: function (v) { + this.storeValue = v || {}; + }, + + empty: function () { + this.display.empty(); + }, + + populate: function () { + this.display.populate.apply(this.display, arguments); + } +}); + +BI.shortcut("bi.multi_select_check_pane", BI.MultiSelectCheckPane);/** + * + * + * 查看已选弹出层的展示面板 + * @class BI.DisplaySelectedList + * @extends BI.Widget + */ +BI.DisplaySelectedList = BI.inherit(BI.Pane, { + + constants: { + height: 25, + lgap: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.DisplaySelectedList.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-display-list", + itemsCreator: BI.emptyFn, + items: [] + }); + }, + + _init: function () { + BI.DisplaySelectedList.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.hasNext = false; + + this.button_group = BI.createWidget({ + type: "bi.list_pane", + element: this, + el: { + type: "bi.loader", + isDefaultInit: false, + logic: { + dynamic: true, + scrolly: true + }, + items: this._createItems(opts.items), + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + layouts: [{ + type: "bi.vertical", + lgap: 10 + }] + }, + itemsCreator: function (options, callback) { + + opts.itemsCreator(options, function (ob) { + self.hasNext = !!ob.hasNext; + callback(self._createItems(ob.items)); + }) + }, + hasNext: function () { + return self.hasNext; + } + }); + }, + + _createItems: function (items) { + return BI.createItems(items, { + type: 'bi.icon_text_item', + cls: 'cursor-default check-font display-list-item bi-tips', + once: true, + invalid: true, + selected: true, + height: this.constants.height, + logic: { + dynamic: true + } + }); + }, + + empty: function () { + this.button_group.empty(); + }, + + populate: function (items) { + if (arguments.length === 0) { + this.button_group.populate(); + } else { + this.button_group.populate(this._createItems(items)); + } + } +}); + +BI.shortcut('bi.display_selected_list', BI.DisplaySelectedList);/** + * + * @class BI.MultiSelectInsertCombo + * @extends BI.Single + */ +BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectInsertCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-insert-combo', itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - onClickContinueSelect: BI.emptyFn + height: 28 }); }, _init: function () { - BI.MultiSelectCheckPane.superclass._init.apply(this, arguments); - - var self = this, opts = this.options; + BI.MultiSelectInsertCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + var assertShowValue = function () { + BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); + self.trigger.getSearcher().setState(self.storeValue); + self.trigger.getCounter().setButtonChecked(self.storeValue); + }; this.storeValue = {}; - this.display = BI.createWidget({ - type: 'bi.display_selected_list', - items: opts.items, + //标记正在请求数据 + this.requesting = false; + + this.trigger = BI.createWidget({ + type: "bi.multi_select_trigger", + height: o.height, + // adapter: this.popup, + masker: { + offset: { + left: 1, + top: 1, + right: 2, + bottom: 33 + } + }, + valueFormatter: o.valueFormatter, itemsCreator: function (op, callback) { - op = BI.extend(op || {}, { - selectedValues: self.storeValue.value + o.itemsCreator(op, function (res) { + if (op.times === 1 && BI.isNotNull(op.keywords)) { + //预防trigger内部把当前的storeValue改掉 + self.trigger.setValue(BI.deepClone(self.getValue())); + } + callback.apply(self, arguments); }); + } + }); + + this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { + self._setStartValue(""); + this.getSearcher().setValue(self.storeValue); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { + self._setStartValue(""); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { + // if (this.getSearcher().hasMatched()) { + var keyword = this.getSearcher().getKeyword(); + self._join({ + type: BI.Selection.Multi, + value: [keyword] + }, function () { + //如果在不选的状态下直接把该值添加进来 if (self.storeValue.type === BI.Selection.Multi) { - callback({ - items: BI.map(self.storeValue.value, function (i, v) { - var txt = opts.valueFormatter(v) || v; - return { - text: txt, - value: v, - title: txt - } - }) - }); - return; + self.storeValue.value.pushDistinct(keyword); } - opts.itemsCreator(op, callback); + self.combo.setValue(self.storeValue); + self._setStartValue(keyword); + assertShowValue(); + self.populate(); + self._setStartValue(""); + }) + // } + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { + var last = BI.last(keywords); + keywords = BI.initial(keywords || []); + if (keywords.length > 0) { + self._joinKeywords(keywords, function () { + if (BI.isEndWithBlank(last)) { + self.combo.setValue(self.storeValue); + assertShowValue(); + self.combo.populate(); + self._setStartValue(""); + } else { + self.combo.setValue(self.storeValue); + assertShowValue(); + } + }); } }); - this.continueSelect = BI.createWidget({ - type: 'bi.text_button', - text: BI.i18nText('BI-Continue_Select'), - cls: 'multi-select-check-selected bi-high-light' + this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { + if (obj instanceof BI.MultiSelectBar) { + self._joinAll(this.getValue(), function () { + assertShowValue(); + }); + } else { + self._join(this.getValue(), function () { + assertShowValue(); + }); + } }); - - this.continueSelect.on(BI.TextButton.EVENT_CHANGE, function () { - opts.onClickContinueSelect(); + this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { + this.getCounter().setValue(self.storeValue); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } }); - BI.createWidget({ - type: 'bi.vtape', - element: this, - items: [{ - height: this.constants.height, - el: { - type: 'bi.left', - cls: 'multi-select-continue-select', - items: [ - { - el: { - type: "bi.label", - text: BI.i18nText('BI-Selected_Data') - }, - lgap: this.constants.lgap, - tgap: this.constants.tgap - }, - { - el: this.continueSelect, - lgap: this.constants.lgap, - tgap: this.constants.tgap - }] + this.combo = BI.createWidget({ + type: "bi.combo", + toggle: false, + el: this.trigger, + adjustLength: 1, + popup: { + type: 'bi.multi_select_popup_view', + ref: function () { + self.popup = this; + self.trigger.setAdapter(this); + }, + listeners: [{ + eventName: BI.MultiSelectPopupView.EVENT_CHANGE, + action: function () { + self.storeValue = this.getValue(); + self._adjust(function () { + assertShowValue(); + }); + } + }, { + eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, + action: function () { + self._defaultState(); + } + }, { + eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, + action: function () { + self.setValue(); + self._defaultState(); + } + }], + itemsCreator: o.itemsCreator, + valueFormatter: o.valueFormatter, + onLoaded: function () { + BI.nextTick(function () { + self.combo.adjustWidth(); + self.combo.adjustHeight(); + self.trigger.getCounter().adjustView(); + self.trigger.getSearcher().adjustView(); + }); } - }, { - height: 'fill', - el: this.display - }] + }, + hideChecker: function (e) { + return triggerBtn.element.find(e.target).length === 0; + } }); - }, - - setValue: function (v) { - this.storeValue = v || {}; - }, - - empty: function () { - this.display.empty(); - }, - - populate: function () { - this.display.populate.apply(this.display, arguments); - } -}); -BI.shortcut("bi.multi_select_check_pane", BI.MultiSelectCheckPane);/** - * - * - * 查看已选弹出层的展示面板 - * @class BI.DisplaySelectedList - * @extends BI.Widget - */ -BI.DisplaySelectedList = BI.inherit(BI.Pane, { + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + this.setValue(self.storeValue); + BI.nextTick(function () { + self.populate(); + }); + }); + //当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 + this.wants2Quit = false; + this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { + //important:关闭弹出时又可能没有退出编辑状态 + self.trigger.stopEditing(); + if (self.requesting === true) { + self.wants2Quit = true; + } else { + self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); + } + }); - constants: { - height: 25, - lgap: 10 + var triggerBtn = BI.createWidget({ + type: "bi.trigger_icon_button", + width: o.height, + height: o.height, + cls: "multi-select-trigger-icon-button bi-border-left" + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + self.trigger.getCounter().hideView(); + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.combo, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: triggerBtn, + right: 0, + top: 0, + bottom: 0 + }] + }) }, - _defaultConfig: function () { - return BI.extend(BI.DisplaySelectedList.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-display-list", - itemsCreator: BI.emptyFn, - items: [] - }); + _defaultState: function () { + this.trigger.stopEditing(); + this.combo.hideView(); }, - _init: function () { - BI.DisplaySelectedList.superclass._init.apply(this, arguments); + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); + }, - var self = this, opts = this.options; + _makeMap: function (values) { + return BI.makeObject(values || []); + }, - this.hasNext = false; + _joinKeywords: function (keywords, callback) { + var self = this, o = this.options; + this._assertValue(this.storeValue); + this.requesting = true; + o.itemsCreator({ + type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA, + keywords: keywords + }, function (ob) { + var values = BI.pluck(ob.items, "value"); + digest(values); + }); - this.button_group = BI.createWidget({ - type: "bi.list_pane", - element: this, - el: { - type: "bi.loader", - isDefaultInit: false, - logic: { - dynamic: true, - scrolly: true - }, - items: this._createItems(opts.items), - chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, - layouts: [{ - type: "bi.vertical", - lgap: 10 - }] - }, - itemsCreator: function (options, callback) { + function digest(items) { + var selectedMap = self._makeMap(items); + BI.each(keywords, function (i, val) { + if (BI.isNotNull(selectedMap[val])) { + self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); + } + }); + self._adjust(callback); + } + }, - opts.itemsCreator(options, function (ob) { - self.hasNext = !!ob.hasNext; - callback(self._createItems(ob.items)); - }) - }, - hasNext: function () { - return self.hasNext; + _joinAll: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + this.requesting = true; + o.itemsCreator({ + type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA, + keywords: [this.trigger.getKey()] + }, function (ob) { + var items = BI.pluck(ob.items, "value"); + if (self.storeValue.type === res.type) { + var change = false; + var map = self._makeMap(self.storeValue.value); + BI.each(items, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (self.storeValue.value = BI.values(map)); + self._adjust(callback); + return; } - }); + var selectedMap = self._makeMap(self.storeValue.value); + var notSelectedMap = self._makeMap(res.value); + var newItems = []; + BI.each(items, function (i, item) { + if (BI.isNotNull(selectedMap[items[i]])) { + delete selectedMap[items[i]]; + } + if (BI.isNull(notSelectedMap[items[i]])) { + newItems.push(item); + } + }); + self.storeValue.value = newItems.concat(BI.values(selectedMap)); + self._adjust(callback); + }) }, - _createItems: function (items) { - return BI.createItems(items, { - type: 'bi.icon_text_item', - cls: 'cursor-default check-font display-list-item bi-tips', - once: true, - invalid: true, - selected: true, - height: this.constants.height, - logic: { - dynamic: true + _adjust: function (callback) { + var self = this, o = this.options; + adjust(); + callback(); + function adjust() { + if (self.wants2Quit === true) { + self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); + self.wants2Quit = false; } - }); + self.requesting = false; + } }, - empty: function () { - this.button_group.empty(); + _join: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + this._assertValue(this.storeValue); + if (this.storeValue.type === res.type) { + var map = this._makeMap(this.storeValue.value); + BI.each(res.value, function (i, v) { + if (!map[v]) { + self.storeValue.value.push(v); + map[v] = v; + } + }); + var change = false; + BI.each(res.assist, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + this._joinAll(res, callback); }, - populate: function (items) { - if (arguments.length === 0) { - this.button_group.populate(); - } else { - this.button_group.populate(this._createItems(items)); - } + _setStartValue: function (value) { + this._startValue = value; + this.popup.setStartValue(value); + }, + + setValue: function (v) { + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.combo.setValue(this.storeValue); + }, + + getValue: function () { + return BI.deepClone(this.storeValue); + }, + + populate: function () { + this.combo.populate.apply(this.combo, arguments); } }); -BI.shortcut('bi.display_selected_list', BI.DisplaySelectedList);/** +BI.extend(BI.MultiSelectInsertCombo, { + REQ_GET_DATA_LENGTH: 0, + REQ_GET_ALL_DATA: -1 +}); + +BI.MultiSelectInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + +BI.shortcut('bi.multi_select_insert_combo', BI.MultiSelectInsertCombo);/** * - * @class BI.MultiSelectInsertCombo + * @class BI.MultiSelectCombo * @extends BI.Single */ -BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { +BI.MultiSelectCombo = BI.inherit(BI.Single, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectInsertCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-insert-combo', + return BI.extend(BI.MultiSelectCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-combo', itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, height: 28 @@ -8524,7 +10056,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }, _init: function () { - BI.MultiSelectInsertCombo.superclass._init.apply(this, arguments); + BI.MultiSelectCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; var assertShowValue = function () { @@ -8568,23 +10100,19 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { self._setStartValue(""); }); this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { - // if (this.getSearcher().hasMatched()) { - var keyword = this.getSearcher().getKeyword(); - self._join({ - type: BI.Selection.Multi, - value: [keyword] - }, function () { - //如果在不选的状态下直接把该值添加进来 - if (self.storeValue.type === BI.Selection.Multi) { - self.storeValue.value.pushDistinct(keyword); - } - self.combo.setValue(self.storeValue); - self._setStartValue(keyword); - assertShowValue(); - self.populate(); - self._setStartValue(""); - }) - // } + if (this.getSearcher().hasMatched()) { + var keyword = this.getSearcher().getKeyword(); + self._join({ + type: BI.Selection.Multi, + value: [keyword] + }, function () { + self.combo.setValue(self.storeValue); + self._setStartValue(keyword); + assertShowValue(); + self.populate(); + self._setStartValue(""); + }) + } }); this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { var last = BI.last(keywords); @@ -8685,7 +10213,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { if (self.requesting === true) { self.wants2Quit = true; } else { - self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); + self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); } }); @@ -8741,7 +10269,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this._assertValue(this.storeValue); this.requesting = true; o.itemsCreator({ - type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA, + type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, keywords: keywords }, function (ob) { var values = BI.pluck(ob.items, "value"); @@ -8764,7 +10292,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this._assertValue(res); this.requesting = true; o.itemsCreator({ - type: BI.MultiSelectInsertCombo.REQ_GET_ALL_DATA, + type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, keywords: [this.trigger.getKey()] }, function (ob) { var items = BI.pluck(ob.items, "value"); @@ -8799,11 +10327,34 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { _adjust: function (callback) { var self = this, o = this.options; - adjust(); - callback(); + if (!this._count) { + o.itemsCreator({ + type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH + }, function (res) { + self._count = res.count; + adjust(); + callback(); + }); + } else { + adjust(); + callback(); + + } + function adjust() { + if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.Multi, + value: [] + } + } else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.All, + value: [] + } + } if (self.wants2Quit === true) { - self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); + self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); self.wants2Quit = false; } self.requesting = false; @@ -8836,434 +10387,463 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this._joinAll(res, callback); }, - _setStartValue: function (value) { - this._startValue = value; - this.popup.setStartValue(value); + _setStartValue: function (value) { + this._startValue = value; + this.popup.setStartValue(value); + }, + + setValue: function (v) { + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.combo.setValue(this.storeValue); + }, + + getValue: function () { + return BI.deepClone(this.storeValue); + }, + + populate: function () { + this._count = null; + this.combo.populate.apply(this.combo, arguments); + } +}); + +BI.extend(BI.MultiSelectCombo, { + REQ_GET_DATA_LENGTH: 0, + REQ_GET_ALL_DATA: -1 +}); + +BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + +BI.shortcut('bi.multi_select_combo', BI.MultiSelectCombo);/** + * 多选加载数据面板 + * Created by guy on 15/11/2. + * @class BI.MultiSelectLoader + * @extends Widget + */ +BI.MultiSelectLoader = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectLoader.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-loader', + logic: { + dynamic: true + }, + el: { + height: 400 + }, + valueFormatter: BI.emptyFn, + itemsCreator: BI.emptyFn, + onLoaded: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectLoader.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + var hasNext = false; + + this.button_group = BI.createWidget({ + type: "bi.select_list", + element: this, + logic: opts.logic, + el: BI.extend({ + onLoaded: opts.onLoaded, + el: { + type: "bi.loader", + isDefaultInit: false, + logic: { + dynamic: true, + scrolly: true + }, + el: { + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + behaviors: { + redmark: function () { + return true; + } + }, + layouts: [{ + type: "bi.vertical" + }] + } + } + }, opts.el), + itemsCreator: function (op, callback) { + var startValue = self._startValue; + self.storeValue && (op = BI.extend(op || {}, { + selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi + ? self.storeValue.value.concat(startValue) : self.storeValue.value + })); + opts.itemsCreator(op, function (ob) { + hasNext = ob.hasNext; + var firstItems = []; + if (op.times === 1 && self.storeValue) { + var json = BI.map(self.storeValue.value, function (i, v) { + var txt = opts.valueFormatter(v) || v; + return { + text: txt, + value: v, + title: txt, + selected: self.storeValue.type === BI.Selection.Multi + } + }); + if (BI.isKey(self._startValue) && !self.storeValue.value.contains(self._startValue)) { + var txt = opts.valueFormatter(startValue) || startValue; + json.unshift({ + text: txt, + value: startValue, + title: txt, + selected: true + }) + } + firstItems = self._createItems(json); + } + callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); + if (op.times === 1 && self.storeValue) { + BI.isKey(startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](startValue); + self.setValue(self.storeValue); + } + (op.times === 1) && self._scrollToTop(); + }); + }, + hasNext: function () { + return hasNext; + } + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectLoader.EVENT_CHANGE, arguments); + }); + }, + + _createItems: function (items) { + return BI.createItems(items, { + type: "bi.multi_select_item", + logic: this.options.logic, + height: 25, + selected: this.isAllSelected() + }) + }, + + _scrollToTop: function () { + var self = this; + BI.delay(function () { + self.button_group.element.scrollTop(0); + }, 30); + }, + + isAllSelected: function () { + return this.button_group.isAllSelected(); + }, + + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); + }, + + setStartValue: function (v) { + this._startValue = v; + }, + + setValue: function (v) { + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.button_group.setValue(this.storeValue); + }, + + getValue: function () { + return this.button_group.getValue(); + }, + + getAllButtons: function () { + return this.button_group.getAllButtons(); + }, + + empty: function () { + this.button_group.empty(); + }, + + populate: function (items) { + this.button_group.populate.apply(this.button_group, arguments); + }, + + resetHeight: function (h) { + this.button_group.resetHeight(h); + }, + + resetWidth: function (w) { + this.button_group.resetWidth(w); + } +}); + +BI.MultiSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_select_loader', BI.MultiSelectLoader);/** + * 带加载的多选下拉面板 + * @class BI.MultiSelectPopupView + * @extends Widget + */ +BI.MultiSelectPopupView = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectPopupView.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-popup-view', + maxWidth: 'auto', + minWidth: 135, + maxHeight: 400, + valueFormatter: BI.emptyFn, + itemsCreator: BI.emptyFn, + onLoaded: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectPopupView.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + + this.loader = BI.createWidget({ + type: "bi.multi_select_loader", + itemsCreator: opts.itemsCreator, + valueFormatter: opts.valueFormatter, + onLoaded: opts.onLoaded + }); + + this.popupView = BI.createWidget({ + type: "bi.multi_popup_view", + stopPropagation: false, + maxWidth: opts.maxWidth, + minWidth: opts.minWidth, + maxHeight: opts.maxHeight, + element: this, + buttons: [BI.i18nText('BI-Basic_Clears'), BI.i18nText('BI-Basic_Sure')], + el: this.loader + }); + + this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectPopupView.EVENT_CHANGE); + }); + this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { + switch (index) { + case 0: + self.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR); + break; + case 1: + self.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM); + break; + } + }); + }, + + isAllSelected: function () { + return this.loader.isAllSelected(); + }, + + setStartValue: function (v) { + this.loader.setStartValue(v); }, setValue: function (v) { - this.storeValue = v || {}; - this._assertValue(this.storeValue); - this.combo.setValue(this.storeValue); + this.popupView.setValue(v); }, getValue: function () { - return BI.deepClone(this.storeValue); + return this.popupView.getValue(); }, - populate: function () { - this.combo.populate.apply(this.combo, arguments); + populate: function (items) { + this.popupView.populate.apply(this.popupView, arguments); + }, + + resetHeight: function (h) { + this.popupView.resetHeight(h); + }, + + resetWidth: function (w) { + this.popupView.resetWidth(w); } }); -BI.extend(BI.MultiSelectInsertCombo, { - REQ_GET_DATA_LENGTH: 0, - REQ_GET_ALL_DATA: -1 -}); +BI.MultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; +BI.MultiSelectPopupView.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; -BI.MultiSelectInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.shortcut('bi.multi_select_insert_combo', BI.MultiSelectInsertCombo);/** +BI.shortcut('bi.multi_select_popup_view', BI.MultiSelectPopupView);/** * - * @class BI.MultiSelectCombo - * @extends BI.Single + * 复选下拉框 + * @class BI.MultiSelectTrigger + * @extends BI.Trigger */ -BI.MultiSelectCombo = BI.inherit(BI.Single, { + +BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { + + constants: { + height: 14, + rgap: 4, + lgap: 4 + }, _defaultConfig: function () { - return BI.extend(BI.MultiSelectCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-combo', + return BI.extend(BI.MultiSelectTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-trigger bi-border", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - height: 28 + searcher: {}, + switcher: {}, + + adapter: null, + masker: {} }); }, _init: function () { - BI.MultiSelectCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; + BI.MultiSelectTrigger.superclass._init.apply(this, arguments); - var assertShowValue = function () { - BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); - self.trigger.getSearcher().setState(self.storeValue); - self.trigger.getCounter().setButtonChecked(self.storeValue); - }; - this.storeValue = {}; - //标记正在请求数据 - this.requesting = false; + var self = this, o = this.options; + if (o.height) { + this.setHeight(o.height - 2); + } - this.trigger = BI.createWidget({ - type: "bi.multi_select_trigger", + this.searcher = BI.createWidget(o.searcher, { + type: "bi.multi_select_searcher", height: o.height, - // adapter: this.popup, - masker: { - offset: { - left: 1, - top: 1, - right: 2, - bottom: 33 - } - }, + itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, - itemsCreator: function (op, callback) { - o.itemsCreator(op, function (res) { - if (op.times === 1 && BI.isNotNull(op.keywords)) { - //预防trigger内部把当前的storeValue改掉 - self.trigger.setValue(BI.deepClone(self.getValue())); - } - callback.apply(self, arguments); - }); - } - }); - - this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { - self._setStartValue(""); - this.getSearcher().setValue(self.storeValue); - }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { - self._setStartValue(""); - }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { - if (this.getSearcher().hasMatched()) { - var keyword = this.getSearcher().getKeyword(); - self._join({ - type: BI.Selection.Multi, - value: [keyword] - }, function () { - self.combo.setValue(self.storeValue); - self._setStartValue(keyword); - assertShowValue(); - self.populate(); - self._setStartValue(""); - }) - } - }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { - var last = BI.last(keywords); - keywords = BI.initial(keywords || []); - if (keywords.length > 0) { - self._joinKeywords(keywords, function () { - if (BI.isEndWithBlank(last)) { - self.combo.setValue(self.storeValue); - assertShowValue(); - self.combo.populate(); - self._setStartValue(""); - } else { - self.combo.setValue(self.storeValue); - assertShowValue(); - } - }); - } - }); - - this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { - if (obj instanceof BI.MultiSelectBar) { - self._joinAll(this.getValue(), function () { - assertShowValue(); - }); - } else { - self._join(this.getValue(), function () { - assertShowValue(); - }); - } - }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { - this.getCounter().setValue(self.storeValue); + popup: {}, + adapter: o.adapter, + masker: o.masker }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { - if (!self.combo.isViewVisible()) { - self.combo.showView(); - } + this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_START); }); - - this.combo = BI.createWidget({ - type: "bi.combo", - toggle: false, - el: this.trigger, - adjustLength: 1, - popup: { - type: 'bi.multi_select_popup_view', - ref: function () { - self.popup = this; - self.trigger.setAdapter(this); - }, - listeners: [{ - eventName: BI.MultiSelectPopupView.EVENT_CHANGE, - action: function () { - self.storeValue = this.getValue(); - self._adjust(function () { - assertShowValue(); - }); - } - }, { - eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, - action: function () { - self._defaultState(); - } - }, { - eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, - action: function () { - self.setValue(); - self._defaultState(); - } - }], - itemsCreator: o.itemsCreator, - valueFormatter: o.valueFormatter, - onLoaded: function () { - BI.nextTick(function () { - self.combo.adjustWidth(); - self.combo.adjustHeight(); - self.trigger.getCounter().adjustView(); - self.trigger.getSearcher().adjustView(); - }); - } - }, - hideChecker: function (e) { - return triggerBtn.element.find(e.target).length === 0; - } + this.searcher.on(BI.MultiSelectSearcher.EVENT_PAUSE, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_PAUSE); }); - - this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { - this.setValue(self.storeValue); - BI.nextTick(function () { - self.populate(); - }); + this.searcher.on(BI.MultiSelectSearcher.EVENT_SEARCHING, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_SEARCHING, arguments); }); - //当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 - this.wants2Quit = false; - this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { - //important:关闭弹出时又可能没有退出编辑状态 - self.trigger.stopEditing(); - if (self.requesting === true) { - self.wants2Quit = true; - } else { - self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); - } + this.searcher.on(BI.MultiSelectSearcher.EVENT_STOP, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_STOP); }); - - var triggerBtn = BI.createWidget({ - type: "bi.trigger_icon_button", - width: o.height, - height: o.height, - cls: "multi-select-trigger-icon-button bi-border-left" + this.searcher.on(BI.MultiSelectSearcher.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_CHANGE, arguments); }); - triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { - self.trigger.getCounter().hideView(); - if (self.combo.isViewVisible()) { - self.combo.hideView(); - } else { - self.combo.showView(); - } + this.numberCounter = BI.createWidget(o.switcher, { + type: 'bi.multi_select_check_selected_switcher', + valueFormatter: o.valueFormatter, + itemsCreator: o.itemsCreator, + adapter: o.adapter, + masker: o.masker }); - BI.createWidget({ - type: "bi.absolute", - element: this, + this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); + }); + this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW); + }); + + var wrapNumberCounter = BI.createWidget({ + type: 'bi.right_vertical_adapt', + hgap: 4, items: [{ - el: this.combo, - left: 0, - right: 0, - top: 0, - bottom: 0 - }, { - el: triggerBtn, - right: 0, - top: 0, - bottom: 0 + el: this.numberCounter }] - }) - }, - - _defaultState: function () { - this.trigger.stopEditing(); - this.combo.hideView(); - }, - - _assertValue: function (val) { - val || (val = {}); - val.type || (val.type = BI.Selection.Multi); - val.value || (val.value = []); - }, - - _makeMap: function (values) { - return BI.makeObject(values || []); - }, + }); - _joinKeywords: function (keywords, callback) { - var self = this, o = this.options; - this._assertValue(this.storeValue); - this.requesting = true; - o.itemsCreator({ - type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, - keywords: keywords - }, function (ob) { - var values = BI.pluck(ob.items, "value"); - digest(values); + var wrapper = BI.createWidget({ + type: 'bi.htape', + element: this, + items: [ + { + el: this.searcher, + width: 'fill' + }, { + el: wrapNumberCounter, + width: 0 + }, { + el: BI.createWidget(), + width: 30 + }] }); - function digest(items) { - var selectedMap = self._makeMap(items); - BI.each(keywords, function (i, val) { - if (BI.isNotNull(selectedMap[val])) { - self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); - } + this.numberCounter.on(BI.Events.VIEW, function (b) { + BI.nextTick(function () {//自动调整宽度 + wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); + wrapper.resize(); }); - self._adjust(callback); - } - }, + }); - _joinAll: function (res, callback) { - var self = this, o = this.options; - this._assertValue(res); - this.requesting = true; - o.itemsCreator({ - type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()] - }, function (ob) { - var items = BI.pluck(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - return; + this.element.click(function (e) { + if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) { + self.numberCounter.hideView(); } - var selectedMap = self._makeMap(self.storeValue.value); - var notSelectedMap = self._makeMap(res.value); - var newItems = []; - BI.each(items, function (i, item) { - if (BI.isNotNull(selectedMap[items[i]])) { - delete selectedMap[items[i]]; - } - if (BI.isNull(notSelectedMap[items[i]])) { - newItems.push(item); - } - }); - self.storeValue.value = newItems.concat(BI.values(selectedMap)); - self._adjust(callback); - }) + }); }, - _adjust: function (callback) { - var self = this, o = this.options; - if (!this._count) { - o.itemsCreator({ - type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH - }, function (res) { - self._count = res.count; - adjust(); - callback(); - }); - } else { - adjust(); - callback(); - - } + getCounter: function () { + return this.numberCounter; + }, - function adjust() { - if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { - self.storeValue = { - type: BI.Selection.Multi, - value: [] - } - } else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) { - self.storeValue = { - type: BI.Selection.All, - value: [] - } - } - if (self.wants2Quit === true) { - self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); - self.wants2Quit = false; - } - self.requesting = false; - } + getSearcher: function () { + return this.searcher; }, - _join: function (res, callback) { - var self = this, o = this.options; - this._assertValue(res); - this._assertValue(this.storeValue); - if (this.storeValue.type === res.type) { - var map = this._makeMap(this.storeValue.value); - BI.each(res.value, function (i, v) { - if (!map[v]) { - self.storeValue.value.push(v); - map[v] = v; - } - }); - var change = false; - BI.each(res.assist, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (this.storeValue.value = BI.values(map)); - self._adjust(callback); - return; - } - this._joinAll(res, callback); + stopEditing: function () { + this.searcher.stopSearch(); + this.numberCounter.hideView(); }, - _setStartValue: function (value) { - this._startValue = value; - this.popup.setStartValue(value); + setAdapter: function (adapter) { + this.searcher.setAdapter(adapter); + this.numberCounter.setAdapter(adapter); }, - setValue: function (v) { - this.storeValue = v || {}; - this._assertValue(this.storeValue); - this.combo.setValue(this.storeValue); + setValue: function (ob) { + this.searcher.setValue(ob); + this.numberCounter.setValue(ob); }, - getValue: function () { - return BI.deepClone(this.storeValue); + getKey: function () { + return this.searcher.getKey(); }, - populate: function () { - this._count = null; - this.combo.populate.apply(this.combo, arguments); + getValue: function () { + return this.searcher.getValue(); } }); -BI.extend(BI.MultiSelectCombo, { - REQ_GET_DATA_LENGTH: 0, - REQ_GET_ALL_DATA: -1 -}); - -BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK"; +BI.MultiSelectTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK"; +BI.MultiSelectTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiSelectTrigger.EVENT_START = "EVENT_START"; +BI.MultiSelectTrigger.EVENT_STOP = "EVENT_STOP"; +BI.MultiSelectTrigger.EVENT_PAUSE = "EVENT_PAUSE"; +BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING"; +BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW"; -BI.shortcut('bi.multi_select_combo', BI.MultiSelectCombo);/** - * 多选加载数据面板 - * Created by guy on 15/11/2. - * @class BI.MultiSelectLoader +BI.shortcut('bi.multi_select_trigger', BI.MultiSelectTrigger);/** + * 多选加载数据搜索loader面板 + * Created by guy on 15/11/4. + * @class BI.MultiSelectSearchLoader * @extends Widget */ -BI.MultiSelectLoader = BI.inherit(BI.Widget, { +BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectLoader.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-loader', - logic: { - dynamic: true - }, - el: { - height: 400 - }, - valueFormatter: BI.emptyFn, + return BI.extend(BI.MultiSelectSearchLoader.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-search-loader', itemsCreator: BI.emptyFn, - onLoaded: BI.emptyFn + keywordGetter: BI.emptyFn, + valueFormatter: BI.emptyFn, }); }, _init: function () { - BI.MultiSelectLoader.superclass._init.apply(this, arguments); + BI.MultiSelectSearchLoader.superclass._init.apply(this, arguments); var self = this, opts = this.options; var hasNext = false; @@ -9271,9 +10851,11 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { this.button_group = BI.createWidget({ type: "bi.select_list", element: this, - logic: opts.logic, - el: BI.extend({ - onLoaded: opts.onLoaded, + logic: { + dynamic: false + }, + el: { + tipText: BI.i18nText("BI-No_Select"), el: { type: "bi.loader", isDefaultInit: false, @@ -9293,43 +10875,23 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { }] } } - }, opts.el), + }, itemsCreator: function (op, callback) { - var startValue = self._startValue; self.storeValue && (op = BI.extend(op || {}, { - selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi - ? self.storeValue.value.concat(startValue) : self.storeValue.value + selectedValues: self.storeValue.value })); opts.itemsCreator(op, function (ob) { + var keyword = ob.keyword = opts.keywordGetter(); hasNext = ob.hasNext; var firstItems = []; if (op.times === 1 && self.storeValue) { - var json = BI.map(self.storeValue.value, function (i, v) { - var txt = opts.valueFormatter(v) || v; - return { - text: txt, - value: v, - title: txt, - selected: self.storeValue.type === BI.Selection.Multi - } - }); - if (BI.isKey(self._startValue) && !self.storeValue.value.contains(self._startValue)) { - var txt = opts.valueFormatter(startValue) || startValue; - json.unshift({ - text: txt, - value: startValue, - title: txt, - selected: true - }) - } + var json = self._filterValues(self.storeValue); firstItems = self._createItems(json); } - callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); + callback(firstItems.concat(self._createItems(ob.items)), keyword); if (op.times === 1 && self.storeValue) { - BI.isKey(startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](startValue); self.setValue(self.storeValue); } - (op.times === 1) && self._scrollToTop(); }); }, hasNext: function () { @@ -9340,44 +10902,53 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectLoader.EVENT_CHANGE, arguments); + self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); }); }, _createItems: function (items) { return BI.createItems(items, { type: "bi.multi_select_item", - logic: this.options.logic, + logic: { + dynamic: false + }, height: 25, selected: this.isAllSelected() }) }, - _scrollToTop: function () { - var self = this; - BI.delay(function () { - self.button_group.element.scrollTop(0); - }, 30); - }, - isAllSelected: function () { return this.button_group.isAllSelected(); }, - _assertValue: function (val) { - val || (val = {}); - val.type || (val.type = BI.Selection.Multi); - val.value || (val.value = []); - }, - - setStartValue: function (v) { - this._startValue = v; + _filterValues: function (src) { + var o = this.options; + var keyword = o.keywordGetter(); + var values = BI.deepClone(src.value) || []; + var newValues = BI.map(values, function (i, v) { + return { + text: o.valueFormatter(v) || v, + value: v + }; + }); + if (BI.isKey(keyword)) { + var search = BI.Func.getSearchResult(newValues, keyword); + values = search.matched.concat(search.finded); + } + return BI.map(values, function (i, v) { + return { + text: v.text, + title: v.text, + value: v.value, + selected: src.type === BI.Selection.All + } + }) }, setValue: function (v) { - this.storeValue = v || {}; - this._assertValue(this.storeValue); - this.button_group.setValue(this.storeValue); + //暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了 + this.storeValue = BI.deepClone(v); + this.button_group.setValue(v); }, getValue: function () { @@ -9405,1051 +10976,1266 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { } }); -BI.MultiSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.multi_select_loader', BI.MultiSelectLoader);/** - * 带加载的多选下拉面板 - * @class BI.MultiSelectPopupView +BI.MultiSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_select_search_loader', BI.MultiSelectSearchLoader);/** + * + * 在搜索框中输入文本弹出的面板 + * @class BI.MultiSelectSearchPane * @extends Widget */ -BI.MultiSelectPopupView = BI.inherit(BI.Widget, { + +BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { + + constants: { + height: 25, + lgap: 10, + tgap: 5 + }, _defaultConfig: function () { - return BI.extend(BI.MultiSelectPopupView.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-popup-view', - maxWidth: 'auto', - minWidth: 135, - maxHeight: 400, - valueFormatter: BI.emptyFn, + return BI.extend(BI.MultiSelectSearchPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-search-pane bi-card", itemsCreator: BI.emptyFn, - onLoaded: BI.emptyFn + valueFormatter: BI.emptyFn, + keywordGetter: BI.emptyFn }); }, _init: function () { - BI.MultiSelectPopupView.superclass._init.apply(this, arguments); - var self = this, opts = this.options; + BI.MultiSelectSearchPane.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.tooltipClick = BI.createWidget({ + type: "bi.label", + invisible: true, + text: BI.i18nText('BI-Click_Blank_To_Select'), + cls: 'multi-select-toolbar', + height: this.constants.height + }); this.loader = BI.createWidget({ - type: "bi.multi_select_loader", - itemsCreator: opts.itemsCreator, - valueFormatter: opts.valueFormatter, - onLoaded: opts.onLoaded + type: "bi.multi_select_search_loader", + keywordGetter: o.keywordGetter, + valueFormatter: o.valueFormatter, + itemsCreator: function (op, callback) { + o.itemsCreator.apply(self, [op, function (res) { + callback(res); + self.setKeyword(o.keywordGetter()); + }]); + } + }); + this.loader.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - this.popupView = BI.createWidget({ - type: "bi.multi_popup_view", - stopPropagation: false, - maxWidth: opts.maxWidth, - minWidth: opts.minWidth, - maxHeight: opts.maxHeight, + this.resizer = BI.createWidget({ + type: "bi.vtape", element: this, - buttons: [BI.i18nText('BI-Basic_Clears'), BI.i18nText('BI-Basic_Sure')], - el: this.loader + items: [{ + el: this.tooltipClick, + height: 0 + }, { + el: this.loader + }] }); + this.tooltipClick.setVisible(false); + }, - this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectPopupView.EVENT_CHANGE); - }); - this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { - switch (index) { - case 0: - self.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR); - break; - case 1: - self.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM); - break; - } - }); + setKeyword: function (keyword) { + var btn; + var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue()); + if (isVisible !== this.tooltipClick.isVisible()) { + this.tooltipClick.setVisible(isVisible); + this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0); + this.resizer.resize(); + } }, isAllSelected: function () { return this.loader.isAllSelected(); }, - setStartValue: function (v) { - this.loader.setStartValue(v); + hasMatched: function () { + return this.tooltipClick.isVisible(); }, setValue: function (v) { - this.popupView.setValue(v); + this.loader.setValue(v); }, getValue: function () { - return this.popupView.getValue(); + return this.loader.getValue(); + }, + + empty: function () { + this.loader.empty(); }, populate: function (items) { - this.popupView.populate.apply(this.popupView, arguments); + this.loader.populate.apply(this.loader, arguments); + } +}); + +BI.MultiSelectSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.multi_select_search_pane", BI.MultiSelectSearchPane);/** + * 查看已选按钮 + * Created by guy on 15/11/3. + * @class BI.MultiSelectCheckSelectedButton + * @extends BI.Single + */ +BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { + + _const: { + checkSelected: BI.i18nText('BI-Check_Selected') + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectCheckSelectedButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-check-selected-button bi-high-light', + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); + var self = this; + this.numberCounter = BI.createWidget({ + type: 'bi.text_button', + element: this, + hgap: 4, + text: "0", + textAlign: 'center', + textHeight: 15 + }); + this.numberCounter.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.numberCounter.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE, arguments); + }); + + this.numberCounter.element.hover(function () { + self.numberCounter.setTag(self.numberCounter.getText()); + self.numberCounter.setText(self._const.checkSelected); + }, function () { + self.numberCounter.setText(self.numberCounter.getTag()); + }); + this.setVisible(false); + }, + + setValue: function (ob) { + var self = this, o = this.options; + ob || (ob = {}); + ob.type || (ob.type = BI.Selection.Multi); + ob.value || (ob.value = []); + if (ob.type === BI.Selection.All) { + o.itemsCreator({ + type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH + }, function (res) { + var length = res.count - ob.value.length; + BI.nextTick(function(){ + self.numberCounter.setText(length); + self.setVisible(length > 0); + }); + }); + return; + } + BI.nextTick(function(){ + self.numberCounter.setText(ob.value.length); + self.setVisible(ob.value.length > 0); + }) }, - resetHeight: function (h) { - this.popupView.resetHeight(h); - }, + getValue: function () { - resetWidth: function (w) { - this.popupView.resetWidth(w); } }); -BI.MultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; -BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; -BI.MultiSelectPopupView.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; - - -BI.shortcut('bi.multi_select_popup_view', BI.MultiSelectPopupView);/** - * - * 复选下拉框 - * @class BI.MultiSelectTrigger - * @extends BI.Trigger +BI.MultiSelectCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_select_check_selected_button', BI.MultiSelectCheckSelectedButton);/** + * 多选输入框 + * Created by guy on 15/11/3. + * @class BI.MultiSelectEditor + * @extends Widget */ +BI.MultiSelectEditor = BI.inherit(BI.Widget, { -BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { - - constants: { - height: 14, - rgap: 4, - lgap: 4 + _const: { + checkSelected: BI.i18nText('BI-Check_Selected') }, _defaultConfig: function () { - return BI.extend(BI.MultiSelectTrigger.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-select-trigger bi-border", - itemsCreator: BI.emptyFn, - valueFormatter: BI.emptyFn, - searcher: {}, - switcher: {}, - - adapter: null, - masker: {} + return BI.extend(BI.MultiSelectEditor.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-editor', + el: {} }); }, _init: function () { - BI.MultiSelectTrigger.superclass._init.apply(this, arguments); - + BI.MultiSelectEditor.superclass._init.apply(this, arguments); var self = this, o = this.options; - if (o.height) { - this.setHeight(o.height - 2); - } - - this.searcher = BI.createWidget(o.searcher, { - type: "bi.multi_select_searcher", + this.editor = BI.createWidget(o.el, { + type: 'bi.state_editor', + element: this, height: o.height, - itemsCreator: o.itemsCreator, - valueFormatter: o.valueFormatter, - popup: {}, - adapter: o.adapter, - masker: o.masker - }); - this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_START); - }); - this.searcher.on(BI.MultiSelectSearcher.EVENT_PAUSE, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_PAUSE); - }); - this.searcher.on(BI.MultiSelectSearcher.EVENT_SEARCHING, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_SEARCHING, arguments); - }); - this.searcher.on(BI.MultiSelectSearcher.EVENT_STOP, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_STOP); - }); - this.searcher.on(BI.MultiSelectSearcher.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_CHANGE, arguments); - }); - this.numberCounter = BI.createWidget(o.switcher, { - type: 'bi.multi_select_check_selected_switcher', - valueFormatter: o.valueFormatter, - itemsCreator: o.itemsCreator, - adapter: o.adapter, - masker: o.masker - }); - this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); - }); - this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { - self.fireEvent(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW); - }); - - var wrapNumberCounter = BI.createWidget({ - type: 'bi.right_vertical_adapt', - hgap: 4, - items: [{ - el: this.numberCounter - }] + watermark: BI.i18nText('BI-Basic_Search'), + allowBlank: true }); - var wrapper = BI.createWidget({ - type: 'bi.htape', - element: this, - items: [ - { - el: this.searcher, - width: 'fill' - }, { - el: wrapNumberCounter, - width: 0 - }, { - el: BI.createWidget(), - width: 30 - }] + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - this.numberCounter.on(BI.Events.VIEW, function (b) { - BI.nextTick(function () {//自动调整宽度 - wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); - wrapper.resize(); - }); + this.editor.on(BI.StateEditor.EVENT_PAUSE, function () { + self.fireEvent(BI.MultiSelectEditor.EVENT_PAUSE); }); + this.editor.on(BI.StateEditor.EVENT_CLICK_LABEL, function () { - this.element.click(function (e) { - if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) { - self.numberCounter.hideView(); - } }); }, - getCounter: function () { - return this.numberCounter; + focus: function () { + this.editor.focus(); }, - getSearcher: function () { - return this.searcher; + blur: function () { + this.editor.blur(); }, - stopEditing: function () { - this.searcher.stopSearch(); - this.numberCounter.hideView(); + setState: function (state) { + this.editor.setState(state); }, - setAdapter: function (adapter) { - this.searcher.setAdapter(adapter); - this.numberCounter.setAdapter(adapter); + setValue: function (v) { + this.editor.setValue(v); }, - setValue: function (ob) { - this.searcher.setValue(ob); - this.numberCounter.setValue(ob); + getValue: function () { + var v = this.editor.getState(); + if (BI.isArray(v) && v.length > 0) { + return v[v.length - 1]; + } else { + return ""; + } }, - getKey: function () { - return this.searcher.getKey(); + getKeywords: function () { + var val = this.editor.getLastValidValue(); + var keywords = val.match(/[\S]+/g); + if (BI.isEndWithBlank(val)) { + return keywords.concat([' ']); + } + return keywords; }, - getValue: function () { - return this.searcher.getValue(); + populate: function (items) { + } }); - -BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK"; -BI.MultiSelectTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK"; -BI.MultiSelectTrigger.EVENT_CHANGE = "EVENT_CHANGE"; -BI.MultiSelectTrigger.EVENT_START = "EVENT_START"; -BI.MultiSelectTrigger.EVENT_STOP = "EVENT_STOP"; -BI.MultiSelectTrigger.EVENT_PAUSE = "EVENT_PAUSE"; -BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING"; -BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW"; - -BI.shortcut('bi.multi_select_trigger', BI.MultiSelectTrigger);/** - * 多选加载数据搜索loader面板 - * Created by guy on 15/11/4. - * @class BI.MultiSelectSearchLoader +BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE"; +BI.shortcut('bi.multi_select_editor', BI.MultiSelectEditor);/** + * searcher + * Created by guy on 15/11/3. + * @class BI.MultiSelectSearcher * @extends Widget */ -BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { +BI.MultiSelectSearcher = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectSearchLoader.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-search-loader', + return BI.extend(BI.MultiSelectSearcher.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-searcher', itemsCreator: BI.emptyFn, - keywordGetter: BI.emptyFn, + el: {}, + popup: {}, valueFormatter: BI.emptyFn, + adapter: null, + masker: {} }); }, _init: function () { - BI.MultiSelectSearchLoader.superclass._init.apply(this, arguments); - - var self = this, opts = this.options; - var hasNext = false; - - this.button_group = BI.createWidget({ - type: "bi.select_list", - element: this, - logic: { - dynamic: false - }, - el: { - tipText: BI.i18nText("BI-No_Select"), - el: { - type: "bi.loader", - isDefaultInit: false, - logic: { - dynamic: true, - scrolly: true - }, - el: { - chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, - behaviors: { - redmark: function () { - return true; - } - }, - layouts: [{ - type: "bi.vertical" - }] - } - } - }, - itemsCreator: function (op, callback) { - self.storeValue && (op = BI.extend(op || {}, { - selectedValues: self.storeValue.value - })); - opts.itemsCreator(op, function (ob) { - var keyword = ob.keyword = opts.keywordGetter(); - hasNext = ob.hasNext; - var firstItems = []; - if (op.times === 1 && self.storeValue) { - var json = self._filterValues(self.storeValue); - firstItems = self._createItems(json); - } - callback(firstItems.concat(self._createItems(ob.items)), keyword); - if (op.times === 1 && self.storeValue) { - self.setValue(self.storeValue); - } - }); + BI.MultiSelectSearcher.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget(o.el, { + type: 'bi.multi_select_editor', + height: o.height + }); + + this.searcher = BI.createWidget({ + type: "bi.searcher", + element: this, + height: o.height, + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback(); }, - hasNext: function () { - return hasNext; + el: this.editor, + + popup: BI.extend({ + type: "bi.multi_select_search_pane", + valueFormatter: o.valueFormatter, + keywordGetter: function () { + return self.editor.getValue(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.editor.getValue(); + this.setKeyword(op.keyword); + o.itemsCreator(op, callback); + } + }, o.popup), + + adapter: o.adapter, + masker: o.masker + }); + this.searcher.on(BI.Searcher.EVENT_START, function () { + self.fireEvent(BI.MultiSelectSearcher.EVENT_START); + }); + this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { + if (this.hasMatched()) { + } + self.fireEvent(BI.MultiSelectSearcher.EVENT_PAUSE); }); - this.button_group.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + this.searcher.on(BI.Searcher.EVENT_STOP, function () { + self.fireEvent(BI.MultiSelectSearcher.EVENT_STOP); }); - this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); + this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectSearcher.EVENT_CHANGE, arguments); + }); + this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () { + var keywords = this.getKeywords(); + self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); }); }, - _createItems: function (items) { - return BI.createItems(items, { - type: "bi.multi_select_item", - logic: { - dynamic: false - }, - height: 25, - selected: this.isAllSelected() - }) + adjustView: function () { + this.searcher.adjustView(); }, - isAllSelected: function () { - return this.button_group.isAllSelected(); + isSearching: function () { + return this.searcher.isSearching(); }, - _filterValues: function (src) { - var o = this.options; - var keyword = o.keywordGetter(); - var values = BI.deepClone(src.value) || []; - var newValues = BI.map(values, function (i, v) { - return { - text: o.valueFormatter(v) || v, - value: v - }; - }); - if (BI.isKey(keyword)) { - var search = BI.Func.getSearchResult(newValues, keyword); - values = search.matched.concat(search.finded); - } - return BI.map(values, function (i, v) { - return { - text: v.text, - title: v.text, - value: v.value, - selected: src.type === BI.Selection.All - } - }) + stopSearch: function () { + this.searcher.stopSearch(); }, - setValue: function (v) { - //暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了 - this.storeValue = BI.deepClone(v); - this.button_group.setValue(v); + getKeyword: function () { + return this.editor.getValue(); }, - getValue: function () { - return this.button_group.getValue(); + hasMatched: function () { + return this.searcher.hasMatched(); }, - getAllButtons: function () { - return this.button_group.getAllButtons(); + hasChecked: function () { + return this.searcher.getView() && this.searcher.getView().hasChecked(); }, - empty: function () { - this.button_group.empty(); + setAdapter: function (adapter) { + this.searcher.setAdapter(adapter); }, - populate: function (items) { - this.button_group.populate.apply(this.button_group, arguments); + setState: function (ob) { + var o = this.options; + ob || (ob = {}); + ob.value || (ob.value = []); + if (ob.type === BI.Selection.All) { + if (BI.size(ob.assist) === 1) { + this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); + } else { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); + } + } else { + if (BI.size(ob.value) === 1) { + this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); + } else { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); + } + } }, - resetHeight: function (h) { - this.button_group.resetHeight(h); + setValue: function (ob) { + this.setState(ob); + this.searcher.setValue(ob); }, - resetWidth: function (w) { - this.button_group.resetWidth(w); + getKey: function () { + return this.editor.getValue(); + }, + + getValue: function () { + return this.searcher.getValue(); + }, + + populate: function (items) { + this.searcher.populate.apply(this.searcher, arguments); } }); -BI.MultiSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.multi_select_search_loader', BI.MultiSelectSearchLoader);/** - * - * 在搜索框中输入文本弹出的面板 - * @class BI.MultiSelectSearchPane +BI.MultiSelectSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.MultiSelectSearcher.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiSelectSearcher.EVENT_START = "EVENT_START"; +BI.MultiSelectSearcher.EVENT_STOP = "EVENT_STOP"; +BI.MultiSelectSearcher.EVENT_PAUSE = "EVENT_PAUSE"; +BI.MultiSelectSearcher.EVENT_SEARCHING = "EVENT_SEARCHING"; +BI.shortcut('bi.multi_select_searcher', BI.MultiSelectSearcher);/** + * 查看已选switcher + * Created by guy on 15/11/3. + * @class BI.MultiSelectCheckSelectedSwitcher * @extends Widget */ - -BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { - - constants: { - height: 25, - lgap: 10, - tgap: 5 - }, +BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectSearchPane.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-select-search-pane bi-card", + return BI.extend(BI.MultiSelectCheckSelectedSwitcher.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-check-selected-switcher', itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - keywordGetter: BI.emptyFn + el: {}, + popup: {}, + adapter: null, + masker: {} }); }, _init: function () { - BI.MultiSelectSearchPane.superclass._init.apply(this, arguments); + BI.MultiSelectCheckSelectedSwitcher.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.tooltipClick = BI.createWidget({ - type: "bi.label", - invisible: true, - text: BI.i18nText('BI-Click_Blank_To_Select'), - cls: 'multi-select-toolbar', - height: this.constants.height + this.button = BI.createWidget(o.el, { + type: "bi.multi_select_check_selected_button", + itemsCreator: o.itemsCreator }); - - this.loader = BI.createWidget({ - type: "bi.multi_select_search_loader", - keywordGetter: o.keywordGetter, - valueFormatter: o.valueFormatter, - itemsCreator: function (op, callback) { - o.itemsCreator.apply(self, [op, function (res) { - callback(res); - self.setKeyword(o.keywordGetter()); - }]); - } + this.button.on(BI.Events.VIEW, function () { + self.fireEvent(BI.Events.VIEW, arguments); }); - this.loader.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + this.switcher = BI.createWidget({ + type: "bi.switcher", + toggle: false, + element: this, + el: this.button, + popup: BI.extend({ + type: "bi.multi_select_check_pane", + valueFormatter: o.valueFormatter, + itemsCreator: o.itemsCreator, + onClickContinueSelect: function () { + self.switcher.hideView(); + } + }, o.popup), + adapter: o.adapter, + masker: o.masker + }); + this.switcher.on(BI.Switcher.EVENT_TRIGGER_CHANGE, function () { + self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE); + }); + this.switcher.on(BI.Switcher.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW); + }); + this.switcher.on(BI.Switcher.EVENT_AFTER_POPUPVIEW, function () { + var me = this; + BI.nextTick(function () { + me.populate(); + }); }); - this.resizer = BI.createWidget({ - type: "bi.vtape", - element: this, - items: [{ - el: this.tooltipClick, - height: 0 - }, { - el: this.loader - }] + this.switcher.element.click(function (e) { + e.stopPropagation(); }); - this.tooltipClick.setVisible(false); }, - setKeyword: function (keyword) { - var btn; - var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue()); - if (isVisible !== this.tooltipClick.isVisible()) { - this.tooltipClick.setVisible(isVisible); - this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0); - this.resizer.resize(); - } + adjustView: function () { + this.switcher.adjustView(); }, - isAllSelected: function () { - return this.loader.isAllSelected(); + hideView: function () { + this.switcher.empty(); + this.switcher.hideView(); }, - hasMatched: function () { - return this.tooltipClick.isVisible(); + setAdapter: function (adapter) { + this.switcher.setAdapter(adapter); }, setValue: function (v) { - this.loader.setValue(v); + this.switcher.setValue(v); }, - getValue: function () { - return this.loader.getValue(); + setButtonChecked: function (v) { + this.button.setValue(v) }, - empty: function () { - this.loader.empty(); + getValue: function () { + }, populate: function (items) { - this.loader.populate.apply(this.loader, arguments); + this.switcher.populate.apply(this.switcher, arguments); } }); -BI.MultiSelectSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; - -BI.shortcut("bi.multi_select_search_pane", BI.MultiSelectSearchPane);/** - * 查看已选按钮 - * Created by guy on 15/11/3. - * @class BI.MultiSelectCheckSelectedButton - * @extends BI.Single +BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE = "MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE"; +BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW = "MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/** + * Created by zcf_1 on 2017/5/2. */ -BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { - - _const: { - checkSelected: BI.i18nText('BI-Check_Selected') - }, - +BI.MultiSelectInsertList = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectCheckSelectedButton.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-check-selected-button bi-high-light', - itemsCreator: BI.emptyFn - }); + return BI.extend(BI.MultiSelectInsertList.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-insert-list', + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn + }) }, - _init: function () { - BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); - var self = this; - this.numberCounter = BI.createWidget({ - type: 'bi.text_button', - element: this, - hgap: 4, - text: "0", - textAlign: 'center', - textHeight: 15 + BI.MultiSelectInsertList.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + this.storeValue = {}; + + var assertShowValue = function () { + BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); + // self.trigger.setValue(self.storeValue); + }; + + this.adapter = BI.createWidget({ + type: "bi.multi_select_loader", + cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom", + itemsCreator: o.itemsCreator, + valueFormatter: o.valueFormatter, + logic: { + dynamic: false + }, + // onLoaded: o.onLoaded, + el: {} }); - this.numberCounter.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE, function () { + self.storeValue = this.getValue(); + assertShowValue(); + self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); }); - this.numberCounter.on(BI.TextButton.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE, arguments); + this.searcherPane = BI.createWidget({ + type: "bi.multi_select_search_pane", + cls: "bi-border-left bi-border-right bi-border-bottom", + valueFormatter: o.valueFormatter, + keywordGetter: function () { + return self.trigger.getKeyword(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.trigger.getKeyword(); + this.setKeyword(op.keyword); + o.itemsCreator(op, callback); + } }); + this.searcherPane.setVisible(false); - this.numberCounter.element.hover(function () { - self.numberCounter.setTag(self.numberCounter.getText()); - self.numberCounter.setText(self._const.checkSelected); - }, function () { - self.numberCounter.setText(self.numberCounter.getTag()); + this.trigger = BI.createWidget({ + type: "bi.searcher", + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback(); + }, + adapter: this.adapter, + popup: this.searcherPane, + height: 200, + masker: false, + listeners: [{ + eventName: BI.Searcher.EVENT_START, + action: function () { + self._showSearcherPane(); + self._setStartValue(""); + this.setValue(BI.deepClone(self.storeValue)); + } + }, { + eventName: BI.Searcher.EVENT_STOP, + action: function () { + self._showAdapter(); + self._setStartValue(""); + self.adapter.setValue(self.storeValue); + //需要刷新回到初始界面,否则搜索的结果不能放在最前面 + self.adapter.populate(); + } + }, { + eventName: BI.Searcher.EVENT_PAUSE, + action: function () { + var keyword = this.getKeyword(); + if (this.hasMatched()) { + self._join({ + type: BI.Selection.Multi, + value: [keyword] + }, function () { + if (self.storeValue.type === BI.Selection.Multi) { + self.storeValue.value.pushDistinct(keyword) + } + self._showAdapter(); + self.adapter.setValue(self.storeValue); + self._setStartValue(keyword); + assertShowValue(); + self.adapter.populate(); + self._setStartValue(""); + self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); + }) + } else { + if (self.storeValue.type === BI.Selection.Multi) { + self.storeValue.value.pushDistinct(keyword) + } + self._showAdapter(); + self.adapter.setValue(self.storeValue); + self.adapter.populate(); + if (self.storeValue.type === BI.Selection.Multi) { + self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); + } + } + } + }, { + eventName: BI.Searcher.EVENT_SEARCHING, + action: function () { + var keywords = this.getKeyword(); + var last = BI.last(keywords); + keywords = BI.initial(keywords || []); + if (keywords.length > 0) { + self._joinKeywords(keywords, function () { + if (BI.isEndWithBlank(last)) { + self.adapter.setValue(self.storeValue); + assertShowValue(); + self.adapter.populate(); + self._setStartValue(""); + } else { + self.adapter.setValue(self.storeValue); + assertShowValue(); + } + }); + } + } + }, { + eventName: BI.Searcher.EVENT_CHANGE, + action: function (value, obj) { + if (obj instanceof BI.MultiSelectBar) { + self._joinAll(this.getValue(), function () { + assertShowValue(); + self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); + }); + } else { + self._join(this.getValue(), function () { + assertShowValue(); + self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); + }); + } + } + }] }); - this.setVisible(false); - }, - setValue: function (ob) { - var self = this, o = this.options; - ob || (ob = {}); - ob.type || (ob.type = BI.Selection.Multi); - ob.value || (ob.value = []); - if (ob.type === BI.Selection.All) { - o.itemsCreator({ - type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH - }, function (res) { - var length = res.count - ob.value.length; - BI.nextTick(function(){ - self.numberCounter.setText(length); - self.setVisible(length > 0); - }); - }); - return; - } - BI.nextTick(function(){ - self.numberCounter.setText(ob.value.length); - self.setVisible(ob.value.length > 0); + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.trigger, + height: 30 + }, { + el: this.adapter, + height: "fill" + }] + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.searcherPane, + top: 30, + bottom: 0, + left: 0, + right: 0 + }] }) }, - getValue: function () { + _showAdapter: function () { + this.adapter.setVisible(true); + this.searcherPane.setVisible(false); + }, - } -}); + _showSearcherPane: function () { + this.searcherPane.setVisible(true); + this.adapter.setVisible(false); + }, -BI.MultiSelectCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.multi_select_check_selected_button', BI.MultiSelectCheckSelectedButton);/** - * 多选输入框 - * Created by guy on 15/11/3. - * @class BI.MultiSelectEditor - * @extends Widget - */ -BI.MultiSelectEditor = BI.inherit(BI.Widget, { + _defaultState: function () { + this.trigger.stopEditing(); + }, - _const: { - checkSelected: BI.i18nText('BI-Check_Selected') + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); }, - _defaultConfig: function () { - return BI.extend(BI.MultiSelectEditor.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-editor', - el: {} - }); + _makeMap: function (values) { + return BI.makeObject(values || []); }, - _init: function () { - BI.MultiSelectEditor.superclass._init.apply(this, arguments); + _joinKeywords: function (keywords, callback) { var self = this, o = this.options; - this.editor = BI.createWidget(o.el, { - type: 'bi.state_editor', - element: this, - height: o.height, - watermark: BI.i18nText('BI-Basic_Search'), - allowBlank: true - }); - - this.editor.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + this._assertValue(this.storeValue); + if (!this._allData) { + o.itemsCreator({ + type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA + }, function (ob) { + self._allData = BI.pluck(ob.items, "value"); + digest(self._allData); + }) + } else { + digest(this._allData) + } - this.editor.on(BI.StateEditor.EVENT_PAUSE, function () { - self.fireEvent(BI.MultiSelectEditor.EVENT_PAUSE); - }); - this.editor.on(BI.StateEditor.EVENT_CLICK_LABEL, function () { + function digest(items) { + var selectedMap = self._makeMap(items); + BI.each(keywords, function (i, val) { + if (BI.isNotNull(selectedMap[val])) { + self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); + } + }); + callback(); + } + }, - }); + _joinAll: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + o.itemsCreator({ + type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA, + keyword: self.trigger.getKeyword() + }, function (ob) { + var items = BI.pluck(ob.items, "value"); + if (self.storeValue.type === res.type) { + var change = false; + var map = self._makeMap(self.storeValue.value); + BI.each(items, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (self.storeValue.value = BI.values(map)); + callback(); + return; + } + var selectedMap = self._makeMap(self.storeValue.value); + var notSelectedMap = self._makeMap(res.value); + var newItems = []; + BI.each(items, function (i, item) { + if (BI.isNotNull(selectedMap[items[i]])) { + delete selectedMap[items[i]]; + } + if (BI.isNull(notSelectedMap[items[i]])) { + newItems.push(item); + } + }); + self.storeValue.value = newItems.concat(BI.values(selectedMap)); + callback(); + }) }, - focus: function () { - this.editor.focus(); + _join: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + this._assertValue(this.storeValue); + if (this.storeValue.type === res.type) { + var map = this._makeMap(this.storeValue.value); + BI.each(res.value, function (i, v) { + if (!map[v]) { + self.storeValue.value.push(v); + map[v] = v; + } + }); + var change = false; + BI.each(res.assist, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + callback(); + return; + } + this._joinAll(res, callback); }, - blur: function () { - this.editor.blur(); + _setStartValue: function (value) { + this._startValue = value; + this.adapter.setStartValue(value); }, - setState: function (state) { - this.editor.setState(state); + isAllSelected: function () { + return this.adapter.isAllSelected(); }, + resize: function () { + // this.trigger.getCounter().adjustView(); + // this.trigger.adjustView(); + }, setValue: function (v) { - this.editor.setValue(v); + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.adapter.setValue(this.storeValue); + this.trigger.setValue(this.storeValue); }, getValue: function () { - var v = this.editor.getState(); - if (BI.isArray(v) && v.length > 0) { - return v[v.length - 1]; - } else { - return ""; - } - }, - - getKeywords: function () { - var val = this.editor.getLastValidValue(); - var keywords = val.match(/[\S]+/g); - if (BI.isEndWithBlank(val)) { - return keywords.concat([' ']); - } - return keywords; + return BI.deepClone(this.storeValue); }, - populate: function (items) { - + populate: function () { + this._count = null; + this._allData = null; + this.adapter.populate.apply(this.adapter, arguments); + this.trigger.populate.apply(this.trigger, arguments); } }); -BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE"; -BI.shortcut('bi.multi_select_editor', BI.MultiSelectEditor);/** - * searcher - * Created by guy on 15/11/3. - * @class BI.MultiSelectSearcher - * @extends Widget - */ -BI.MultiSelectSearcher = BI.inherit(BI.Widget, { +BI.extend(BI.MultiSelectInsertList, { + REQ_GET_DATA_LENGTH: 0, + REQ_GET_ALL_DATA: -1 +}); + +BI.MultiSelectInsertList.EVENT_CHANGE = "BI.MultiSelectInsertList.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_insert_list", BI.MultiSelectInsertList);/** + * Created by zcf_1 on 2017/5/2. + */ +BI.MultiSelectList = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectSearcher.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-searcher', + return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-list', itemsCreator: BI.emptyFn, - el: {}, - popup: {}, - valueFormatter: BI.emptyFn, - adapter: null, - masker: {} - }); + valueFormatter: BI.emptyFn + }) }, - _init: function () { - BI.MultiSelectSearcher.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.editor = BI.createWidget(o.el, { - type: 'bi.multi_select_editor', - height: o.height - }); + BI.MultiSelectList.superclass._init.apply(this, arguments); - this.searcher = BI.createWidget({ - type: "bi.searcher", - element: this, - height: o.height, - isAutoSearch: false, - isAutoSync: false, - onSearch: function (op, callback) { - callback(); - }, - el: this.editor, + var self = this, o = this.options; + this.storeValue = {}; - popup: BI.extend({ - type: "bi.multi_select_search_pane", - valueFormatter: o.valueFormatter, - keywordGetter: function () { - return self.editor.getValue(); - }, - itemsCreator: function (op, callback) { - op.keyword = self.editor.getValue(); - this.setKeyword(op.keyword); - o.itemsCreator(op, callback); - } - }, o.popup), + var assertShowValue = function () { + BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); + // self.trigger.setValue(self.storeValue); + }; - adapter: o.adapter, - masker: o.masker + this.adapter = BI.createWidget({ + type: "bi.multi_select_loader", + cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom", + itemsCreator: o.itemsCreator, + valueFormatter: o.valueFormatter, + logic: { + dynamic: false + }, + // onLoaded: o.onLoaded, + el: {} }); - this.searcher.on(BI.Searcher.EVENT_START, function () { - self.fireEvent(BI.MultiSelectSearcher.EVENT_START); + this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE, function () { + self.storeValue = this.getValue(); + self._adjust(function () { + assertShowValue(); + self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); + }); }); - this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { - if (this.hasMatched()) { + this.searcherPane = BI.createWidget({ + type: "bi.multi_select_search_pane", + cls: "bi-border-left bi-border-right bi-border-bottom", + valueFormatter: o.valueFormatter, + keywordGetter: function () { + return self.trigger.getKeyword(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.trigger.getKeyword(); + this.setKeyword(op.keyword); + o.itemsCreator(op, callback); } - self.fireEvent(BI.MultiSelectSearcher.EVENT_PAUSE); - }); - this.searcher.on(BI.Searcher.EVENT_STOP, function () { - self.fireEvent(BI.MultiSelectSearcher.EVENT_STOP); - }); - this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectSearcher.EVENT_CHANGE, arguments); }); - this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () { - var keywords = this.getKeywords(); - self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); - }); - }, + this.searcherPane.setVisible(false); - adjustView: function () { - this.searcher.adjustView(); - }, + this.trigger = BI.createWidget({ + type: "bi.searcher", + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback(); + }, + adapter: this.adapter, + popup: this.searcherPane, + height: 200, + masker: false, + listeners: [{ + eventName: BI.Searcher.EVENT_START, + action: function () { + self._showSearcherPane(); + self._setStartValue(""); + this.setValue(BI.deepClone(self.storeValue)); + } + }, { + eventName: BI.Searcher.EVENT_STOP, + action: function () { + self._showAdapter(); + self._setStartValue(""); + self.adapter.setValue(self.storeValue); + //需要刷新回到初始界面,否则搜索的结果不能放在最前面 + self.adapter.populate(); + } + }, { + eventName: BI.Searcher.EVENT_PAUSE, + action: function () { + var keyword = this.getKeyword(); + if (this.hasMatched()) { + self._join({ + type: BI.Selection.Multi, + value: [keyword] + }, function () { + self._showAdapter(); + self.adapter.setValue(self.storeValue); + self._setStartValue(keyword); + assertShowValue(); + self.adapter.populate(); + self._setStartValue(""); + self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); + }) + } + } + }, { + eventName: BI.Searcher.EVENT_SEARCHING, + action: function () { + var keywords = this.getKeyword(); + var last = BI.last(keywords); + keywords = BI.initial(keywords || []); + if (keywords.length > 0) { + self._joinKeywords(keywords, function () { + if (BI.isEndWithBlank(last)) { + self.adapter.setValue(self.storeValue); + assertShowValue(); + self.adapter.populate(); + self._setStartValue(""); + } else { + self.adapter.setValue(self.storeValue); + assertShowValue(); + } + }); + } + } + }, { + eventName: BI.Searcher.EVENT_CHANGE, + action: function (value, obj) { + if (obj instanceof BI.MultiSelectBar) { + self._joinAll(this.getValue(), function () { + assertShowValue(); + self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); + }); + } else { + self._join(this.getValue(), function () { + assertShowValue(); + self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); + }); + } + } + }] + }); - isSearching: function () { - return this.searcher.isSearching(); + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.trigger, + height: 30 + }, { + el: this.adapter, + height: "fill" + }] + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.searcherPane, + top: 30, + bottom: 0, + left: 0, + right: 0 + }] + }) }, - stopSearch: function () { - this.searcher.stopSearch(); + _showAdapter: function () { + this.adapter.setVisible(true); + this.searcherPane.setVisible(false); }, - getKeyword: function () { - return this.editor.getValue(); + _showSearcherPane: function () { + this.searcherPane.setVisible(true); + this.adapter.setVisible(false); }, - hasMatched: function () { - return this.searcher.hasMatched(); + _defaultState: function () { + this.trigger.stopEditing(); }, - hasChecked: function () { - return this.searcher.getView() && this.searcher.getView().hasChecked(); + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); }, - setAdapter: function (adapter) { - this.searcher.setAdapter(adapter); + _makeMap: function (values) { + return BI.makeObject(values || []); }, - setState: function (ob) { - var o = this.options; - ob || (ob = {}); - ob.value || (ob.value = []); - if (ob.type === BI.Selection.All) { - if (BI.size(ob.assist) === 1) { - this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); - } else { - this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); - } + _joinKeywords: function (keywords, callback) { + var self = this, o = this.options; + this._assertValue(this.storeValue); + if (!this._allData) { + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_ALL_DATA + }, function (ob) { + self._allData = BI.pluck(ob.items, "value"); + digest(self._allData); + }) } else { - if (BI.size(ob.value) === 1) { - this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); - } else { - this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); - } + digest(this._allData) } - }, - - setValue: function (ob) { - this.setState(ob); - this.searcher.setValue(ob); - }, - getKey: function () { - return this.editor.getValue(); + function digest(items) { + var selectedMap = self._makeMap(items); + BI.each(keywords, function (i, val) { + if (BI.isNotNull(selectedMap[val])) { + self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); + } + }); + self._adjust(callback); + } }, - getValue: function () { - return this.searcher.getValue(); + _joinAll: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_ALL_DATA, + keyword: self.trigger.getKeyword() + }, function (ob) { + var items = BI.pluck(ob.items, "value"); + if (self.storeValue.type === res.type) { + var change = false; + var map = self._makeMap(self.storeValue.value); + BI.each(items, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (self.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + var selectedMap = self._makeMap(self.storeValue.value); + var notSelectedMap = self._makeMap(res.value); + var newItems = []; + BI.each(items, function (i, item) { + if (BI.isNotNull(selectedMap[items[i]])) { + delete selectedMap[items[i]]; + } + if (BI.isNull(notSelectedMap[items[i]])) { + newItems.push(item); + } + }); + self.storeValue.value = newItems.concat(BI.values(selectedMap)); + self._adjust(callback); + }) }, - populate: function (items) { - this.searcher.populate.apply(this.searcher, arguments); - } -}); - -BI.MultiSelectSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; -BI.MultiSelectSearcher.EVENT_CHANGE = "EVENT_CHANGE"; -BI.MultiSelectSearcher.EVENT_START = "EVENT_START"; -BI.MultiSelectSearcher.EVENT_STOP = "EVENT_STOP"; -BI.MultiSelectSearcher.EVENT_PAUSE = "EVENT_PAUSE"; -BI.MultiSelectSearcher.EVENT_SEARCHING = "EVENT_SEARCHING"; -BI.shortcut('bi.multi_select_searcher', BI.MultiSelectSearcher);/** - * 查看已选switcher - * Created by guy on 15/11/3. - * @class BI.MultiSelectCheckSelectedSwitcher - * @extends Widget - */ -BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { + _adjust: function (callback) { + var self = this, o = this.options; + if (!this._count) { + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_DATA_LENGTH + }, function (res) { + self._count = res.count; + adjust(); + callback(); + }); + } else { + adjust(); + callback(); + } - _defaultConfig: function () { - return BI.extend(BI.MultiSelectCheckSelectedSwitcher.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-check-selected-switcher', - itemsCreator: BI.emptyFn, - valueFormatter: BI.emptyFn, - el: {}, - popup: {}, - adapter: null, - masker: {} - }); + function adjust() { + if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.Multi, + value: [] + } + } else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.All, + value: [] + } + } + } }, - _init: function () { - BI.MultiSelectCheckSelectedSwitcher.superclass._init.apply(this, arguments); + _join: function (res, callback) { var self = this, o = this.options; - - this.button = BI.createWidget(o.el, { - type: "bi.multi_select_check_selected_button", - itemsCreator: o.itemsCreator - }); - this.button.on(BI.Events.VIEW, function () { - self.fireEvent(BI.Events.VIEW, arguments); - }); - this.switcher = BI.createWidget({ - type: "bi.switcher", - toggle: false, - element: this, - el: this.button, - popup: BI.extend({ - type: "bi.multi_select_check_pane", - valueFormatter: o.valueFormatter, - itemsCreator: o.itemsCreator, - onClickContinueSelect: function () { - self.switcher.hideView(); + this._assertValue(res); + this._assertValue(this.storeValue); + if (this.storeValue.type === res.type) { + var map = this._makeMap(this.storeValue.value); + BI.each(res.value, function (i, v) { + if (!map[v]) { + self.storeValue.value.push(v); + map[v] = v; } - }, o.popup), - adapter: o.adapter, - masker: o.masker - }); - this.switcher.on(BI.Switcher.EVENT_TRIGGER_CHANGE, function () { - self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE); - }); - this.switcher.on(BI.Switcher.EVENT_BEFORE_POPUPVIEW, function () { - self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW); - }); - this.switcher.on(BI.Switcher.EVENT_AFTER_POPUPVIEW, function () { - var me = this; - BI.nextTick(function () { - me.populate(); }); - }); - - this.switcher.element.click(function (e) { - e.stopPropagation(); - }); + var change = false; + BI.each(res.assist, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + this._joinAll(res, callback); }, - adjustView: function () { - this.switcher.adjustView(); + _setStartValue: function (value) { + this._startValue = value; + this.adapter.setStartValue(value); }, - hideView: function () { - this.switcher.empty(); - this.switcher.hideView(); + isAllSelected: function () { + return this.adapter.isAllSelected(); }, - setAdapter: function (adapter) { - this.switcher.setAdapter(adapter); + resize: function () { + // this.trigger.getCounter().adjustView(); + // this.trigger.adjustView(); }, - setValue: function (v) { - this.switcher.setValue(v); - }, - - setButtonChecked: function (v) { - this.button.setValue(v) + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.adapter.setValue(this.storeValue); + this.trigger.setValue(this.storeValue); }, getValue: function () { - + return BI.deepClone(this.storeValue); }, - populate: function (items) { - this.switcher.populate.apply(this.switcher, arguments); + populate: function () { + this._count = null; + this._allData = null; + this.adapter.populate.apply(this.adapter, arguments); + this.trigger.populate.apply(this.trigger, arguments); } }); -BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE = "MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE"; -BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW = "MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW"; -BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/** - * Created by zcf_1 on 2017/5/2. +BI.extend(BI.MultiSelectList, { + REQ_GET_DATA_LENGTH: 0, + REQ_GET_ALL_DATA: -1 +}); + +BI.MultiSelectList.EVENT_CHANGE = "BI.MultiSelectList.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_list", BI.MultiSelectList);/** + * Created by zcf_1 on 2017/5/11. */ -BI.MultiSelectInsertList = BI.inherit(BI.Widget, { +BI.MultiSelectTree = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiSelectInsertList.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-insert-list', - itemsCreator: BI.emptyFn, - valueFormatter: BI.emptyFn + return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-tree', + itemsCreator: BI.emptyFn }) }, - _init: function () { - BI.MultiSelectInsertList.superclass._init.apply(this, arguments); + _init: function () { + BI.MultiSelectTree.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.storeValue = {}; - - var assertShowValue = function () { - BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); - // self.trigger.setValue(self.storeValue); - }; + this.storeValue = {value: {}}; this.adapter = BI.createWidget({ - type: "bi.multi_select_loader", - cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom", - itemsCreator: o.itemsCreator, - valueFormatter: o.valueFormatter, - logic: { - dynamic: false - }, - // onLoaded: o.onLoaded, - el: {} + type: "bi.multi_select_tree_popup", + itemsCreator: o.itemsCreator }); - this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE, function () { - self.storeValue = this.getValue(); - assertShowValue(); - self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); + this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () { + if (self.searcher.isSearching()) { + self.storeValue = {value: self.searcherPane.getValue()}; + } else { + self.storeValue = {value: self.adapter.getValue()}; + } + self.setSelectedValue(self.storeValue.value); + self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); }); + //搜索中的时候用的是parttree,同adapter中的synctree不一样 this.searcherPane = BI.createWidget({ - type: "bi.multi_select_search_pane", + type: "bi.multi_tree_search_pane", cls: "bi-border-left bi-border-right bi-border-bottom", - valueFormatter: o.valueFormatter, keywordGetter: function () { - return self.trigger.getKeyword(); + return self.searcher.getKeyword(); }, itemsCreator: function (op, callback) { - op.keyword = self.trigger.getKeyword(); - this.setKeyword(op.keyword); + op.keyword = self.searcher.getKeyword(); o.itemsCreator(op, callback); } }); this.searcherPane.setVisible(false); - this.trigger = BI.createWidget({ + this.searcher = BI.createWidget({ type: "bi.searcher", isAutoSearch: false, isAutoSync: false, onSearch: function (op, callback) { - callback(); + callback({ + keyword: self.searcher.getKeyword() + }); }, adapter: this.adapter, popup: this.searcherPane, - height: 200, masker: false, listeners: [{ eventName: BI.Searcher.EVENT_START, action: function () { self._showSearcherPane(); - self._setStartValue(""); - this.setValue(BI.deepClone(self.storeValue)); - } - }, { - eventName: BI.Searcher.EVENT_STOP, - action: function () { - self._showAdapter(); - self._setStartValue(""); - self.adapter.setValue(self.storeValue); - //需要刷新回到初始界面,否则搜索的结果不能放在最前面 - self.adapter.populate(); - } - }, { - eventName: BI.Searcher.EVENT_PAUSE, - action: function () { - var keyword = this.getKeyword(); - if (this.hasMatched()) { - self._join({ - type: BI.Selection.Multi, - value: [keyword] - }, function () { - if (self.storeValue.type === BI.Selection.Multi) { - self.storeValue.value.pushDistinct(keyword) - } - self._showAdapter(); - self.adapter.setValue(self.storeValue); - self._setStartValue(keyword); - assertShowValue(); - self.adapter.populate(); - self._setStartValue(""); - self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); - }) - } else { - if (self.storeValue.type === BI.Selection.Multi) { - self.storeValue.value.pushDistinct(keyword) - } - self._showAdapter(); - self.adapter.setValue(self.storeValue); - self.adapter.populate(); - if (self.storeValue.type === BI.Selection.Multi) { - self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); - } - } - } - }, { - eventName: BI.Searcher.EVENT_SEARCHING, - action: function () { - var keywords = this.getKeyword(); - var last = BI.last(keywords); - keywords = BI.initial(keywords || []); - if (keywords.length > 0) { - self._joinKeywords(keywords, function () { - if (BI.isEndWithBlank(last)) { - self.adapter.setValue(self.storeValue); - assertShowValue(); - self.adapter.populate(); - self._setStartValue(""); - } else { - self.adapter.setValue(self.storeValue); - assertShowValue(); - } - }); - } + // self.storeValue = {value: self.adapter.getValue()}; + // self.searcherPane.setSelectedValue(self.storeValue.value); + } + }, { + eventName: BI.Searcher.EVENT_STOP, + action: function () { + self._showAdapter(); + // self.storeValue = {value: self.searcherPane.getValue()}; + // self.adapter.setSelectedValue(self.storeValue.value); + BI.nextTick(function () { + self.adapter.populate(); + }); } }, { eventName: BI.Searcher.EVENT_CHANGE, - action: function (value, obj) { - if (obj instanceof BI.MultiSelectBar) { - self._joinAll(this.getValue(), function () { - assertShowValue(); - self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); - }); + action: function () { + if (self.searcher.isSearching()) { + self.storeValue = {value: self.searcherPane.getValue()}; } else { - self._join(this.getValue(), function () { - assertShowValue(); - self.fireEvent(BI.MultiSelectInsertList.EVENT_CHANGE); - }); + self.storeValue = {value: self.adapter.getValue()}; } + self.setSelectedValue(self.storeValue.value); + self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); + } + }, { + eventName: BI.Searcher.EVENT_PAUSE, + action: function () { + self._showAdapter(); } }] }); @@ -10458,7 +12244,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, { type: "bi.vtape", element: this, items: [{ - el: this.trigger, + el: this.searcher, height: 30 }, { el: this.adapter, @@ -10476,6 +12262,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, { right: 0 }] }) + }, _showAdapter: function () { @@ -10488,5574 +12275,5888 @@ BI.MultiSelectInsertList = BI.inherit(BI.Widget, { this.adapter.setVisible(false); }, - _defaultState: function () { - this.trigger.stopEditing(); + resize: function () { + }, - _assertValue: function (val) { - val || (val = {}); - val.type || (val.type = BI.Selection.Multi); - val.value || (val.value = []); + setSelectedValue: function (v) { + this.storeValue.value = v || {}; + this.adapter.setSelectedValue(v); + this.searcherPane.setSelectedValue(v); + this.searcher.setValue({ + value: v || {} + }); }, - _makeMap: function (values) { - return BI.makeObject(values || []); + setValue: function (v) { + this.adapter.setValue(v); }, - _joinKeywords: function (keywords, callback) { - var self = this, o = this.options; - this._assertValue(this.storeValue); - if (!this._allData) { - o.itemsCreator({ - type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA - }, function (ob) { - self._allData = BI.pluck(ob.items, "value"); - digest(self._allData); - }) - } else { - digest(this._allData) - } + stopSearch: function () { + this.searcher.stopSearch(); + }, - function digest(items) { - var selectedMap = self._makeMap(items); - BI.each(keywords, function (i, val) { - if (BI.isNotNull(selectedMap[val])) { - self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); - } - }); - callback(); - } + updateValue: function (v) { + this.adapter.updateValue(v); }, - _joinAll: function (res, callback) { + getValue: function () { + return this.storeValue.value; + }, + + populate: function () { + this.searcher.populate.apply(this.searcher, arguments); + this.adapter.populate.apply(this.adapter, arguments); + } +}); +BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/** + * Created by zcf on 2016/12/21. + */ +BI.MultiSelectTreePopup = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom", + itemsCreator: BI.emptyFn + }); + }, + _init: function () { + BI.MultiSelectTreePopup.superclass._init.apply(this, arguments); var self = this, o = this.options; - this._assertValue(res); - o.itemsCreator({ - type: BI.MultiSelectInsertList.REQ_GET_ALL_DATA, - keyword: self.trigger.getKeyword() - }, function (ob) { - var items = BI.pluck(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - callback(); - return; - } - var selectedMap = self._makeMap(self.storeValue.value); - var notSelectedMap = self._makeMap(res.value); - var newItems = []; - BI.each(items, function (i, item) { - if (BI.isNotNull(selectedMap[items[i]])) { - delete selectedMap[items[i]]; - } - if (BI.isNull(notSelectedMap[items[i]])) { - newItems.push(item); - } - }); - self.storeValue.value = newItems.concat(BI.values(selectedMap)); - callback(); - }) + this.popup = BI.createWidget({ + type: "bi.async_tree", + element: this, + itemsCreator: o.itemsCreator + }); + this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () { + self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT) + }); + this.popup.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE) + }); + }, + + hasChecked: function () { + return this.popup.hasChecked(); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + v || (v = {}); + this.popup.setValue(v); + }, + + setSelectedValue: function (v) { + v || (v = {}); + this.popup.setSelectedValue(v); + }, + + updateValue: function (v) { + this.popup.updateValue(v); + this.popup.refresh(); + }, + + populate: function (config) { + this.popup.stroke(config); + } + +}); +BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT"; +BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);/** + * + * @class BI.MultiTreeCheckPane + * @extends BI.Pane + */ +BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { + + constants: { + height: 25, + lgap: 10, + tgap: 5 }, - _join: function (res, callback) { - var self = this, o = this.options; - this._assertValue(res); - this._assertValue(this.storeValue); - if (this.storeValue.type === res.type) { - var map = this._makeMap(this.storeValue.value); - BI.each(res.value, function (i, v) { - if (!map[v]) { - self.storeValue.value.push(v); - map[v] = v; - } - }); - var change = false; - BI.each(res.assist, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (this.storeValue.value = BI.values(map)); - callback(); - return; - } - this._joinAll(res, callback); - }, + _defaultConfig: function () { + return BI.extend(BI.MultiTreeCheckPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-tree-check-pane bi-background", + onClickContinueSelect: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiTreeCheckPane.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.selectedValues = {}; + + var continueSelect = BI.createWidget({ + type: 'bi.text_button', + text: BI.i18nText('BI-Continue_Select'), + cls: 'multi-tree-check-selected' + }); + continueSelect.on(BI.TextButton.EVENT_CHANGE, function () { + opts.onClickContinueSelect(); + BI.nextTick(function () { + self.empty(); + }); + }); + + var backToPopup = BI.createWidget({ + type: 'bi.left', + cls: 'multi-tree-continue-select', + items: [ + { + el: { + type: "bi.label", + text: BI.i18nText('BI-Selected_Data') + }, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }, + { + el: continueSelect, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }] + }); + + this.display = BI.createWidget({ + type: "bi.display_tree", + cls: "bi-multi-tree-display", + itemsCreator: function (op, callback) { + op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; + opts.itemsCreator(op, callback); + } + }); + + this.display.on(BI.Events.AFTERINIT, function () { + self.fireEvent(BI.Events.AFTERINIT); + }); + + this.display.on(BI.TreeView.EVENT_INIT, function () { + backToPopup.setVisible(false); + }); + + this.display.on(BI.TreeView.EVENT_AFTERINIT, function () { + backToPopup.setVisible(true); + }); + + BI.createWidget({ + type: 'bi.vtape', + element: this, + items: [{ + height: this.constants.height, + el: backToPopup + }, { + height: 'fill', + el: this.display + }] + }); - _setStartValue: function (value) { - this._startValue = value; - this.adapter.setStartValue(value); }, - isAllSelected: function () { - return this.adapter.isAllSelected(); + empty: function () { + this.display.empty(); }, - resize: function () { - // this.trigger.getCounter().adjustView(); - // this.trigger.adjustView(); + populate: function (configs) { + this.display.stroke(configs); }, + setValue: function (v) { - this.storeValue = v || {}; - this._assertValue(this.storeValue); - this.adapter.setValue(this.storeValue); - this.trigger.setValue(this.storeValue); + v || (v = {}); + this.display.setSelectedValue(v.value); }, getValue: function () { - return BI.deepClone(this.storeValue); - }, - populate: function () { - this._count = null; - this._allData = null; - this.adapter.populate.apply(this.adapter, arguments); - this.trigger.populate.apply(this.trigger, arguments); } }); -BI.extend(BI.MultiSelectInsertList, { - REQ_GET_DATA_LENGTH: 0, - REQ_GET_ALL_DATA: -1 -}); +BI.MultiTreeCheckPane.EVENT_CONTINUE_CLICK = "EVENT_CONTINUE_CLICK"; -BI.MultiSelectInsertList.EVENT_CHANGE = "BI.MultiSelectInsertList.EVENT_CHANGE"; -BI.shortcut("bi.multi_select_insert_list", BI.MultiSelectInsertList);/** - * Created by zcf_1 on 2017/5/2. + +BI.shortcut("bi.multi_tree_check_pane", BI.MultiTreeCheckPane);/** + * + * @class BI.MultiTreeCombo + * @extends BI.Single */ -BI.MultiSelectList = BI.inherit(BI.Widget, { + +BI.MultiTreeCombo = BI.inherit(BI.Single, { + + constants: { + offset: { + top: 1, + left: 1, + right: 2, + bottom: 33 + } + }, + _defaultConfig: function () { - return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-list', + return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-combo', itemsCreator: BI.emptyFn, - valueFormatter: BI.emptyFn - }) + height: 25 + }); }, + _init: function () { - BI.MultiSelectList.superclass._init.apply(this, arguments); + BI.MultiTreeCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.storeValue = {}; - var assertShowValue = function () { - BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); - // self.trigger.setValue(self.storeValue); - }; + var isInit = false; + var want2showCounter = false; - this.adapter = BI.createWidget({ - type: "bi.multi_select_loader", - cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom", - itemsCreator: o.itemsCreator, - valueFormatter: o.valueFormatter, - logic: { - dynamic: false + this.trigger = BI.createWidget({ + type: "bi.multi_select_trigger", + height: o.height, + // adapter: this.popup, + masker: { + offset: this.constants.offset }, - // onLoaded: o.onLoaded, - el: {} - }); - this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE, function () { - self.storeValue = this.getValue(); - self._adjust(function () { - assertShowValue(); - self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); - }); - }); - - this.searcherPane = BI.createWidget({ - type: "bi.multi_select_search_pane", - cls: "bi-border-left bi-border-right bi-border-bottom", - valueFormatter: o.valueFormatter, - keywordGetter: function () { - return self.trigger.getKeyword(); + searcher: { + type: "bi.multi_tree_searcher", + itemsCreator: o.itemsCreator }, - itemsCreator: function (op, callback) { - op.keyword = self.trigger.getKeyword(); - this.setKeyword(op.keyword); - o.itemsCreator(op, callback); + switcher: { + el: { + type: "bi.multi_tree_check_selected_button" + }, + popup: { + type: "bi.multi_tree_check_pane", + itemsCreator: o.itemsCreator + } } + }); - this.searcherPane.setVisible(false); - this.trigger = BI.createWidget({ - type: "bi.searcher", - isAutoSearch: false, - isAutoSync: false, - onSearch: function (op, callback) { - callback(); - }, - adapter: this.adapter, - popup: this.searcherPane, - height: 200, - masker: false, - listeners: [{ - eventName: BI.Searcher.EVENT_START, - action: function () { - self._showSearcherPane(); - self._setStartValue(""); - this.setValue(BI.deepClone(self.storeValue)); - } - }, { - eventName: BI.Searcher.EVENT_STOP, - action: function () { - self._showAdapter(); - self._setStartValue(""); - self.adapter.setValue(self.storeValue); - //需要刷新回到初始界面,否则搜索的结果不能放在最前面 - self.adapter.populate(); - } - }, { - eventName: BI.Searcher.EVENT_PAUSE, - action: function () { - var keyword = this.getKeyword(); - if (this.hasMatched()) { - self._join({ - type: BI.Selection.Multi, - value: [keyword] - }, function () { - self._showAdapter(); - self.adapter.setValue(self.storeValue); - self._setStartValue(keyword); - assertShowValue(); - self.adapter.populate(); - self._setStartValue(""); - self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); - }) - } - } - }, { - eventName: BI.Searcher.EVENT_SEARCHING, - action: function () { - var keywords = this.getKeyword(); - var last = BI.last(keywords); - keywords = BI.initial(keywords || []); - if (keywords.length > 0) { - self._joinKeywords(keywords, function () { - if (BI.isEndWithBlank(last)) { - self.adapter.setValue(self.storeValue); - assertShowValue(); - self.adapter.populate(); - self._setStartValue(""); - } else { - self.adapter.setValue(self.storeValue); - assertShowValue(); - } - }); + this.combo = BI.createWidget({ + type: "bi.combo", + toggle: false, + el: this.trigger, + adjustLength: 1, + popup: { + type: 'bi.multi_tree_popup_view', + ref: function () { + self.popup = this; + self.trigger.setAdapter(this); + }, + listeners: [{ + eventName: BI.MultiTreePopup.EVENT_AFTERINIT, + action: function () { + self.trigger.getCounter().adjustView(); + isInit = true; + if (want2showCounter === true) { + showCounter(); + } } - } - }, { - eventName: BI.Searcher.EVENT_CHANGE, - action: function (value, obj) { - if (obj instanceof BI.MultiSelectBar) { - self._joinAll(this.getValue(), function () { - assertShowValue(); - self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); - }); - } else { - self._join(this.getValue(), function () { - assertShowValue(); - self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); - }); + }, { + eventName: BI.MultiTreePopup.EVENT_CHANGE, + action: function () { + change = true; + var val = { + type: BI.Selection.Multi, + value: this.hasChecked() ? {1: 1} : {} + }; + self.trigger.getSearcher().setState(val); + self.trigger.getCounter().setButtonChecked(val); + } + }, { + eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, + action: function () { + self.combo.hideView(); + } + }, { + eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, + action: function () { + clear = true; + self.setValue(); + self._defaultState(); } + }], + itemsCreator: o.itemsCreator, + onLoaded: function () { + BI.nextTick(function () { + self.trigger.getCounter().adjustView(); + self.trigger.getSearcher().adjustView(); + }); } - }] - }); - - BI.createWidget({ - type: "bi.vtape", - element: this, - items: [{ - el: this.trigger, - height: 30 - }, { - el: this.adapter, - height: "fill" - }] + }, + hideChecker: function (e) { + return triggerBtn.element.find(e.target).length === 0; + } }); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.searcherPane, - top: 30, - bottom: 0, - left: 0, - right: 0 - }] - }) - }, - - _showAdapter: function () { - this.adapter.setVisible(true); - this.searcherPane.setVisible(false); - }, - - _showSearcherPane: function () { - this.searcherPane.setVisible(true); - this.adapter.setVisible(false); - }, - _defaultState: function () { - this.trigger.stopEditing(); - }, - - _assertValue: function (val) { - val || (val = {}); - val.type || (val.type = BI.Selection.Multi); - val.value || (val.value = []); - }, + this.storeValue = {value: {}}; + var change = false; + var clear = false; //标识当前是否点击了清空 - _makeMap: function (values) { - return BI.makeObject(values || []); - }, + var isSearching = function () { + return self.trigger.getSearcher().isSearching(); + }; - _joinKeywords: function (keywords, callback) { - var self = this, o = this.options; - this._assertValue(this.storeValue); - if (!this._allData) { - o.itemsCreator({ - type: BI.MultiSelectList.REQ_GET_ALL_DATA - }, function (ob) { - self._allData = BI.pluck(ob.items, "value"); - digest(self._allData); - }) - } else { - digest(this._allData) - } + var isPopupView = function () { + return self.combo.isViewVisible(); + }; - function digest(items) { - var selectedMap = self._makeMap(items); - BI.each(keywords, function (i, val) { - if (BI.isNotNull(selectedMap[val])) { - self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); + this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { + self.storeValue = {value: self.combo.getValue()}; + this.setValue(self.storeValue); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { + self.storeValue = {value: this.getValue()}; + self.combo.setValue(self.storeValue); + BI.nextTick(function () { + if (isPopupView()) { + self.combo.populate(); } }); - self._adjust(callback); + }); + function showCounter() { + if (isSearching()) { + self.storeValue = {value: self.trigger.getValue()}; + } else if (isPopupView()) { + self.storeValue = {value: self.combo.getValue()}; + } + self.trigger.setValue(self.storeValue); } - }, - _joinAll: function (res, callback) { - var self = this, o = this.options; - this._assertValue(res); - o.itemsCreator({ - type: BI.MultiSelectList.REQ_GET_ALL_DATA, - keyword: self.trigger.getKeyword() - }, function (ob) { - var items = BI.pluck(ob.items, "value"); - if (self.storeValue.type === res.type) { - var change = false; - var map = self._makeMap(self.storeValue.value); - BI.each(items, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; - } - }); - change && (self.storeValue.value = BI.values(map)); - self._adjust(callback); - return; + this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { + if (want2showCounter === false) { + want2showCounter = true; } - var selectedMap = self._makeMap(self.storeValue.value); - var notSelectedMap = self._makeMap(res.value); - var newItems = []; - BI.each(items, function (i, item) { - if (BI.isNotNull(selectedMap[items[i]])) { - delete selectedMap[items[i]]; - } - if (BI.isNull(notSelectedMap[items[i]])) { - newItems.push(item); - } - }); - self.storeValue.value = newItems.concat(BI.values(selectedMap)); - self._adjust(callback); - }) - }, + if (isInit === true) { + want2showCounter = null; + showCounter(); + } + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK, function () { + self.combo.toggle(); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } + }); - _adjust: function (callback) { - var self = this, o = this.options; - if (!this._count) { - o.itemsCreator({ - type: BI.MultiSelectList.REQ_GET_DATA_LENGTH - }, function (res) { - self._count = res.count; - adjust(); - callback(); - }); - } else { - adjust(); - callback(); - } + this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { + var val = { + type: BI.Selection.Multi, + value: this.getSearcher().hasChecked() ? {1: 1} : {} + }; + this.getSearcher().setState(val); + this.getCounter().setButtonChecked(val); + }); - function adjust() { - if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { - self.storeValue = { - type: BI.Selection.Multi, - value: [] - } - } else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) { - self.storeValue = { - type: BI.Selection.All, - value: [] - } + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + if (isSearching()) { + return; } - } - }, + if (change === true) { + self.storeValue = {value: self.combo.getValue()}; + change = false; + } + self.combo.setValue(self.storeValue); + self.populate(); - _join: function (res, callback) { - var self = this, o = this.options; - this._assertValue(res); - this._assertValue(this.storeValue); - if (this.storeValue.type === res.type) { - var map = this._makeMap(this.storeValue.value); - BI.each(res.value, function (i, v) { - if (!map[v]) { - self.storeValue.value.push(v); - map[v] = v; - } - }); - var change = false; - BI.each(res.assist, function (i, v) { - if (BI.isNotNull(map[v])) { - change = true; - delete map[v]; + }); + this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { + if (isSearching()) { + self.trigger.stopEditing(); + self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + }else{ + if (isPopupView()) { + self.trigger.stopEditing(); + self.storeValue = {value: self.combo.getValue()}; + if (clear === true) { + self.storeValue = {value: {}}; + } + self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); } - }); - change && (this.storeValue.value = BI.values(map)); - self._adjust(callback); - return; - } - this._joinAll(res, callback); - }, + } + clear = false; + change = false; + }); - _setStartValue: function (value) { - this._startValue = value; - this.adapter.setStartValue(value); + var triggerBtn = BI.createWidget({ + type: "bi.trigger_icon_button", + width: o.height, + height: o.height, + cls: "multi-select-trigger-icon-button bi-border-left" + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + self.trigger.getCounter().hideView(); + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.combo, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: triggerBtn, + right: 0, + top: 0, + bottom: 0 + }] + }) }, - isAllSelected: function () { - return this.adapter.isAllSelected(); + _defaultState: function () { + this.trigger.stopEditing(); + this.combo.hideView(); }, - resize: function () { - // this.trigger.getCounter().adjustView(); - // this.trigger.adjustView(); - }, setValue: function (v) { - this.storeValue = v || {}; - this._assertValue(this.storeValue); - this.adapter.setValue(this.storeValue); - this.trigger.setValue(this.storeValue); + this.storeValue.value = v || {}; + this.combo.setValue({ + value: v || {} + }); }, getValue: function () { - return BI.deepClone(this.storeValue); + return this.storeValue.value; }, populate: function () { - this._count = null; - this._allData = null; - this.adapter.populate.apply(this.adapter, arguments); - this.trigger.populate.apply(this.trigger, arguments); + this.combo.populate.apply(this.combo, arguments); } }); -BI.extend(BI.MultiSelectList, { - REQ_GET_DATA_LENGTH: 0, - REQ_GET_ALL_DATA: -1 -}); +BI.MultiTreeCombo.EVENT_CONFIRM = "MultiTreeCombo.EVENT_CONFIRM"; -BI.MultiSelectList.EVENT_CHANGE = "BI.MultiSelectList.EVENT_CHANGE"; -BI.shortcut("bi.multi_select_list", BI.MultiSelectList);/** - * Created by zcf_1 on 2017/5/11. +BI.shortcut('bi.multi_tree_combo', BI.MultiTreeCombo);/** + * 带加载的多选下拉面板 + * @class BI.MultiTreePopup + * @extends BI.Pane */ -BI.MultiSelectTree = BI.inherit(BI.Widget, { +BI.MultiTreePopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { - return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-select-tree', - itemsCreator: BI.emptyFn - }) + return BI.extend(BI.MultiTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-popup', + maxWidth: 'auto', + minWidth: 100, + maxHeight: 400, + onLoaded: BI.emptyFn + }); }, _init: function () { - BI.MultiSelectTree.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.storeValue = {value: {}}; + BI.MultiTreePopup.superclass._init.apply(this, arguments); - this.adapter = BI.createWidget({ - type: "bi.multi_select_tree_popup", - itemsCreator: o.itemsCreator + var self = this, opts = this.options; + + this.selectedValues = {}; + + this.tree = BI.createWidget({ + type: "bi.async_tree", + height: 400, + cls:"popup-view-tree", + itemsCreator: opts.itemsCreator, + onLoaded: opts.onLoaded }); - this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () { - if (self.searcher.isSearching()) { - self.storeValue = {value: self.searcherPane.getValue()}; - } else { - self.storeValue = {value: self.adapter.getValue()}; - } - self.setSelectedValue(self.storeValue.value); - self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); + + this.popupView = BI.createWidget({ + type: "bi.multi_popup_view", + element: this, + stopPropagation: false, + maxWidth: opts.maxWidth, + minWidth: opts.minWidth, + maxHeight: opts.maxHeight, + buttons: [BI.i18nText('BI-Basic_Clears'), BI.i18nText('BI-Basic_Sure')], + el: this.tree }); - //搜索中的时候用的是parttree,同adapter中的synctree不一样 - this.searcherPane = BI.createWidget({ - type: "bi.multi_tree_search_pane", - cls: "bi-border-left bi-border-right bi-border-bottom", - keywordGetter: function () { - return self.searcher.getKeyword(); - }, - itemsCreator: function (op, callback) { - op.keyword = self.searcher.getKeyword(); - o.itemsCreator(op, callback); + this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { + switch (index) { + case 0: + self.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CLEAR); + break; + case 1: + self.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CONFIRM); + break; } }); - this.searcherPane.setVisible(false); - this.searcher = BI.createWidget({ - type: "bi.searcher", - isAutoSearch: false, - isAutoSync: false, - onSearch: function (op, callback) { - callback({ - keyword: self.searcher.getKeyword() - }); - }, - adapter: this.adapter, - popup: this.searcherPane, - masker: false, - listeners: [{ - eventName: BI.Searcher.EVENT_START, - action: function () { - self._showSearcherPane(); - // self.storeValue = {value: self.adapter.getValue()}; - // self.searcherPane.setSelectedValue(self.storeValue.value); - } - }, { - eventName: BI.Searcher.EVENT_STOP, - action: function () { - self._showAdapter(); - // self.storeValue = {value: self.searcherPane.getValue()}; - // self.adapter.setSelectedValue(self.storeValue.value); - BI.nextTick(function () { - self.adapter.populate(); - }); - } - }, { - eventName: BI.Searcher.EVENT_CHANGE, - action: function () { - if (self.searcher.isSearching()) { - self.storeValue = {value: self.searcherPane.getValue()}; - } else { - self.storeValue = {value: self.adapter.getValue()}; - } - self.setSelectedValue(self.storeValue.value); - self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); - } - }, { - eventName: BI.Searcher.EVENT_PAUSE, - action: function () { - self._showAdapter(); - } - }] + this.tree.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiTreePopup.EVENT_CHANGE); }); - BI.createWidget({ - type: "bi.vtape", - element: this, - items: [{ - el: this.searcher, - height: 30 - }, { - el: this.adapter, - height: "fill" - }] + this.tree.on(BI.TreeView.EVENT_AFTERINIT, function () { + self.fireEvent(BI.MultiTreePopup.EVENT_AFTERINIT); }); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.searcherPane, - top: 30, - bottom: 0, - left: 0, - right: 0 - }] - }) }, - _showAdapter: function () { - this.adapter.setVisible(true); - this.searcherPane.setVisible(false); + getValue: function () { + return this.tree.getValue(); }, - _showSearcherPane: function () { - this.searcherPane.setVisible(true); - this.adapter.setVisible(false); + setValue: function (v) { + v || (v = {}); + this.tree.setSelectedValue(v.value); }, - resize: function () { - + populate: function (config) { + this.tree.stroke(config); }, - setSelectedValue: function (v) { - this.storeValue.value = v || {}; - this.adapter.setSelectedValue(v); - this.searcherPane.setSelectedValue(v); - this.searcher.setValue({ - value: v || {} - }); + hasChecked: function () { + return this.tree.hasChecked(); }, - setValue: function (v) { - this.adapter.setValue(v); + resetHeight: function (h) { + this.popupView.resetHeight(h); }, - stopSearch: function () { - this.searcher.stopSearch(); - }, + resetWidth: function (w) { + this.popupView.resetWidth(w); + } +}); - updateValue: function (v) { - this.adapter.updateValue(v); - }, +BI.MultiTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiTreePopup.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; +BI.MultiTreePopup.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; +BI.MultiTreePopup.EVENT_AFTERINIT = "EVENT_AFTERINIT"; - getValue: function () { - return this.storeValue.value; - }, - populate: function () { - this.searcher.populate.apply(this.searcher, arguments); - this.adapter.populate.apply(this.adapter, arguments); - } -}); -BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE"; -BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/** - * Created by zcf on 2016/12/21. +BI.shortcut('bi.multi_tree_popup_view', BI.MultiTreePopup);/** + * + * 在搜索框中输入文本弹出的面板 + * @class BI.MultiTreeSearchPane + * @extends BI.Pane */ -BI.MultiSelectTreePopup = BI.inherit(BI.Widget, { + +BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { + _defaultConfig: function () { - return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom", - itemsCreator: BI.emptyFn + return BI.extend(BI.MultiTreeSearchPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-tree-search-pane bi-card", + itemsCreator: BI.emptyFn, + keywordGetter: BI.emptyFn }); }, + _init: function () { - BI.MultiSelectTreePopup.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.popup = BI.createWidget({ - type: "bi.async_tree", + BI.MultiTreeSearchPane.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.partTree = BI.createWidget({ + type: "bi.part_tree", element: this, - itemsCreator: o.itemsCreator + tipText: BI.i18nText("BI-No_Select"), + itemsCreator: function (op, callback) { + op.keyword = opts.keywordGetter(); + opts.itemsCreator(op, callback); + } }); - this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () { - self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT) + + this.partTree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - this.popup.on(BI.TreeView.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE) + + this.partTree.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE); }); }, hasChecked: function () { - return this.popup.hasChecked(); - }, - - getValue: function () { - return this.popup.getValue(); + return this.partTree.hasChecked(); }, setValue: function (v) { - v || (v = {}); - this.popup.setValue(v); + this.setSelectedValue(v.value); }, setSelectedValue: function (v) { v || (v = {}); - this.popup.setSelectedValue(v); + this.partTree.setSelectedValue(v); }, - updateValue: function (v) { - this.popup.updateValue(v); - this.popup.refresh(); + getValue: function () { + return this.partTree.getValue(); }, - populate: function (config) { - this.popup.stroke(config); - } + empty: function () { + this.partTree.empty(); + }, + populate: function (op) { + this.partTree.stroke.apply(this.partTree, arguments); + } }); -BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT"; -BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE"; -BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);/** - * - * @class BI.MultiTreeCheckPane - * @extends BI.Pane + +BI.MultiTreeSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; +BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; + +BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);/** + * 查看已选按钮 + * Created by guy on 15/11/3. + * @class BI.MultiTreeCheckSelectedButton + * @extends BI.Single */ -BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { +BI.MultiTreeCheckSelectedButton = BI.inherit(BI.Single, { - constants: { - height: 25, - lgap: 10, - tgap: 5 + _const: { + checkSelected: BI.i18nText('BI-Check_Selected') }, _defaultConfig: function () { - return BI.extend(BI.MultiTreeCheckPane.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-tree-check-pane bi-background", - onClickContinueSelect: BI.emptyFn + return BI.extend(BI.MultiTreeCheckSelectedButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-check-selected-button', + itemsCreator: BI.emptyFn }); }, _init: function () { - BI.MultiTreeCheckPane.superclass._init.apply(this, arguments); - - var self = this, opts = this.options; - - this.selectedValues = {}; + BI.MultiTreeCheckSelectedButton.superclass._init.apply(this, arguments); + var self = this; + this.indicator = BI.createWidget({ + type: 'bi.icon_button', + cls: 'check-font trigger-check-selected', + width: 15, + height: 15, + stopPropagation: true + }); - var continueSelect = BI.createWidget({ + this.checkSelected = BI.createWidget({ type: 'bi.text_button', - text: BI.i18nText('BI-Continue_Select'), - cls: 'multi-tree-check-selected' + cls: "trigger-check-selected", + invisible: true, + hgap: 4, + text: this._const.checkSelected, + textAlign: 'center', + textHeight: 15 }); - continueSelect.on(BI.TextButton.EVENT_CHANGE, function () { - opts.onClickContinueSelect(); - BI.nextTick(function () { - self.empty(); - }); + this.checkSelected.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - var backToPopup = BI.createWidget({ - type: 'bi.left', - cls: 'multi-tree-continue-select', - items: [ - { - el: { - type: "bi.label", - text: BI.i18nText('BI-Selected_Data') - }, - lgap: this.constants.lgap, - tgap: this.constants.tgap - }, - { - el: continueSelect, - lgap: this.constants.lgap, - tgap: this.constants.tgap - }] + this.checkSelected.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE, arguments); }); - this.display = BI.createWidget({ - type: "bi.display_tree", - cls: "bi-multi-tree-display", - itemsCreator: function (op, callback) { - op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; - opts.itemsCreator(op, callback); - } - }); + BI.createWidget({ + type: "bi.horizontal", + element: this, + items: [this.indicator, this.checkSelected] + }) - this.display.on(BI.Events.AFTERINIT, function () { - self.fireEvent(BI.Events.AFTERINIT); + this.element.hover(function () { + self.indicator.setVisible(false); + self.checkSelected.setVisible(true); + }, function () { + self.indicator.setVisible(true); + self.checkSelected.setVisible(false); }); + this.setVisible(false); + }, - this.display.on(BI.TreeView.EVENT_INIT, function () { - backToPopup.setVisible(false); + setValue: function (v) { + v || (v = {}); + this.setVisible(BI.size(v.value) > 0); + } +}); + +BI.MultiTreeCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_tree_check_selected_button', BI.MultiTreeCheckSelectedButton);/** + * searcher + * Created by guy on 15/11/3. + * @class BI.MultiTreeSearcher + * @extends Widget + */ +BI.MultiTreeSearcher = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-searcher', + itemsCreator: BI.emptyFn, + popup: {}, + + adapter: null, + masker: {} }); + }, - this.display.on(BI.TreeView.EVENT_AFTERINIT, function () { - backToPopup.setVisible(true); + _init: function () { + BI.MultiTreeSearcher.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: 'bi.multi_select_editor', + height: o.height, + el: { + type: "bi.simple_state_editor", + height: o.height + } }); - BI.createWidget({ - type: 'bi.vtape', + this.searcher = BI.createWidget({ + type: "bi.searcher", element: this, - items: [{ - height: this.constants.height, - el: backToPopup - }, { - height: 'fill', - el: this.display - }] + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback({ + keyword: self.editor.getValue() + }); + }, + el: this.editor, + + popup: BI.extend({ + type: "bi.multi_tree_search_pane", + keywordGetter: function () { + return self.editor.getValue(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.editor.getValue(); + o.itemsCreator(op, callback); + } + }, o.popup), + + adapter: o.adapter, + masker: o.masker + }); + this.searcher.on(BI.Searcher.EVENT_START, function () { + self.fireEvent(BI.MultiTreeSearcher.EVENT_START); + }); + this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { + if (this.hasMatched()) { + + } + self.fireEvent(BI.MultiTreeSearcher.EVENT_PAUSE); + }); + this.searcher.on(BI.Searcher.EVENT_STOP, function () { + self.fireEvent(BI.MultiTreeSearcher.EVENT_STOP); + }); + this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); }); + }, + adjustView: function () { + this.searcher.adjustView(); }, - empty: function () { - this.display.empty(); + setAdapter: function (adapter) { + this.searcher.setAdapter(adapter); }, - populate: function (configs) { - this.display.stroke(configs); + isSearching: function () { + return this.searcher.isSearching(); }, - setValue: function (v) { - v || (v = {}); - this.display.setSelectedValue(v.value); + stopSearch: function () { + this.searcher.stopSearch(); }, - getValue: function () { + getKeyword: function () { + return this.editor.getValue(); + }, - } -}); + hasMatched: function () { + return this.searcher.hasMatched(); + }, -BI.MultiTreeCheckPane.EVENT_CONTINUE_CLICK = "EVENT_CONTINUE_CLICK"; + hasChecked: function () { + return this.searcher.getView() && this.searcher.getView().hasChecked(); + }, + setState: function (ob) { + ob || (ob = {}); + ob.value || (ob.value = []); + if (ob.type === BI.Selection.All) { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); + } else { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); + } + }, -BI.shortcut("bi.multi_tree_check_pane", BI.MultiTreeCheckPane);/** - * - * @class BI.MultiTreeCombo - * @extends BI.Single - */ + setValue: function (ob) { + this.setState(ob); + this.searcher.setValue(ob); + }, -BI.MultiTreeCombo = BI.inherit(BI.Single, { + getKey: function () { + return this.editor.getValue(); + }, - constants: { - offset: { - top: 1, - left: 1, - right: 2, - bottom: 33 - } + getValue: function () { + return this.searcher.getValue(); }, + populate: function (items) { + this.searcher.populate.apply(this.searcher, arguments); + } +}); + +BI.MultiTreeSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; +BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; +BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; +BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);/** + * Created by windy on 2017/3/13. + * 数值微调器 + */ +BI.NumberEditor = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-tree-combo', - itemsCreator: BI.emptyFn, - height: 25 - }); + return BI.extend(BI.NumberEditor.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-number-editor bi-border", + validationChecker: function () { + return true; + }, + valueFormatter: function (v) { + return v; + }, + value: 0, + allowBlank: false, + errorText: "", + step: 1 + }) }, _init: function () { - BI.MultiTreeCombo.superclass._init.apply(this, arguments); - + BI.NumberEditor.superclass._init.apply(this, arguments); var self = this, o = this.options; - - var isInit = false; - var want2showCounter = false; - - this.trigger = BI.createWidget({ - type: "bi.multi_select_trigger", + this.editor = BI.createWidget({ + type: "bi.sign_editor", height: o.height, - // adapter: this.popup, - masker: { - offset: this.constants.offset - }, - searcher: { - type: "bi.multi_tree_searcher", - itemsCreator: o.itemsCreator - }, - switcher: { + allowBlank: o.allowBlank, + value: o.valueFormatter(o.value), + validationChecker: o.validationChecker, + errorText: o.errorText + }); + this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { + o.value = this.getValue(); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + }); + this.topBtn = BI.createWidget({ + type: "bi.icon_button", + trigger: "lclick,", + cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom" + }); + this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { + self._finetuning(o.step); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + }); + this.bottomBtn = BI.createWidget({ + type: "bi.icon_button", + trigger: "lclick,", + cls: "column-next-page-h-font bottom-button bi-border-left bi-border-top" + }); + this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { + self._finetuning(-o.step); + self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + }); + BI.createWidget({ + type: "bi.htape", + element: this, + items: [this.editor, { el: { - type: "bi.multi_tree_check_selected_button" + type: "bi.grid", + columns: 1, + rows: 2, + items: [{ + column: 0, + row: 0, + el: this.topBtn + }, { + column: 0, + row: 1, + el: this.bottomBtn + }] }, - popup: { - type: "bi.multi_tree_check_pane", - itemsCreator: o.itemsCreator - } - } - + width: 23 + }] }); + }, - this.combo = BI.createWidget({ - type: "bi.combo", - toggle: false, - el: this.trigger, - adjustLength: 1, - popup: { - type: 'bi.multi_tree_popup_view', - ref: function () { - self.popup = this; - self.trigger.setAdapter(this); - }, - listeners: [{ - eventName: BI.MultiTreePopup.EVENT_AFTERINIT, - action: function () { - self.trigger.getCounter().adjustView(); - isInit = true; - if (want2showCounter === true) { - showCounter(); - } - } - }, { - eventName: BI.MultiTreePopup.EVENT_CHANGE, - action: function () { - change = true; - var val = { - type: BI.Selection.Multi, - value: this.hasChecked() ? {1: 1} : {} - }; - self.trigger.getSearcher().setState(val); - self.trigger.getCounter().setButtonChecked(val); - } - }, { - eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, - action: function () { - self.combo.hideView(); - } - }, { - eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, - action: function () { - clear = true; - self.setValue(); - self._defaultState(); - } - }], - itemsCreator: o.itemsCreator, - onLoaded: function () { - BI.nextTick(function () { - self.trigger.getCounter().adjustView(); - self.trigger.getSearcher().adjustView(); - }); - } - }, - hideChecker: function (e) { - return triggerBtn.element.find(e.target).length === 0; - } - }); + //微调 + _finetuning: function (add) { + var v = BI.parseFloat(this.getValue()); + this.setValue(v.add(add)); + }, - this.storeValue = {value: {}}; - var change = false; - var clear = false; //标识当前是否点击了清空 + setUpEnable: function (v) { + this.topBtn.setEnable(!!v); + }, - var isSearching = function () { - return self.trigger.getSearcher().isSearching(); - }; + setDownEnable: function (v) { + this.bottomBtn.setEnable(!!v); + }, + + getValue: function () { + return this.options.value; + }, - var isPopupView = function () { - return self.combo.isViewVisible(); - }; + setValue: function (v) { + var o = this.options; + o.value = v; + this.editor.setValue(o.valueFormatter(v)); + } - this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { - self.storeValue = {value: self.combo.getValue()}; - this.setValue(self.storeValue); - }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { - self.storeValue = {value: this.getValue()}; - self.combo.setValue(self.storeValue); - BI.nextTick(function () { - if (isPopupView()) { - self.combo.populate(); +}); +BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.number_editor", BI.NumberEditor);//小于号的值为:0,小于等于号的值为:1 +//closeMIn:最小值的符号,closeMax:最大值的符号 +/** + * Created by roy on 15/9/17. + * + */ +BI.NumberInterval = BI.inherit(BI.Single, { + constants: { + typeError: "typeBubble", + numberError: "numberBubble", + signalError: "signalBubble", + editorWidth: 114, + columns: 5, + width: 30, + rows: 1, + numberErrorCls: "number-error", + border: 1, + less: 0, + less_equal: 1, + numTip: "" + }, + _defaultConfig: function () { + var conf = BI.NumberInterval.superclass._defaultConfig.apply(this, arguments) + return BI.extend(conf, { + extraCls: "bi-number-interval", + height: 25, + validation: "valid" + }) + }, + _init: function () { + var self = this, c = this.constants, o = this.options; + BI.NumberInterval.superclass._init.apply(this, arguments) + this.smallEditor = BI.createWidget({ + type: "bi.editor", + height: o.height - 2, + watermark: BI.i18nText("BI-Basic_Unrestricted"), + allowBlank: true, + value: o.min, + level: "warning", + tipType: "warning", + quitChecker: function () { + return false; + }, + validationChecker: function (v) { + if (!BI.isNumeric(v)) { + self.smallEditorBubbleType = c.typeError; + return false; } - }); + return true; + }, + cls: "number-interval-small-editor bi-border-top bi-border-bottom bi-border-left" }); - function showCounter() { - if (isSearching()) { - self.storeValue = {value: self.trigger.getValue()}; - } else if (isPopupView()) { - self.storeValue = {value: self.combo.getValue()}; - } - self.trigger.setValue(self.storeValue); - } - this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { - if (want2showCounter === false) { - want2showCounter = true; - } - if (isInit === true) { - want2showCounter = null; - showCounter(); - } - }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK, function () { - self.combo.toggle(); + this.smallTip = BI.createWidget({ + type: "bi.label", + text: o.numTip, + height: o.height - 2, + invisible: true }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { - if (!self.combo.isViewVisible()) { - self.combo.showView(); - } + BI.createWidget({ + type: "bi.absolute", + element: this.smallEditor.element, + items: [{ + el: this.smallTip, + top: 0, + right: 5 + }] }); - this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { - var val = { - type: BI.Selection.Multi, - value: this.getSearcher().hasChecked() ? {1: 1} : {} - }; - this.getSearcher().setState(val); - this.getCounter().setButtonChecked(val); + this.bigEditor = BI.createWidget({ + type: "bi.editor", + height: o.height - 2, + watermark: BI.i18nText("BI-Basic_Unrestricted"), + allowBlank: true, + value: o.max, + level: "warning", + tipType: "warning", + quitChecker: function () { + return false; + }, + validationChecker: function (v) { + if (!BI.isNumeric(v)) { + self.bigEditorBubbleType = c.typeError; + return false; + } + return true; + }, + cls: "number-interval-big-editor bi-border-top bi-border-bottom bi-border-right" }); - this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { - if (isSearching()) { - return; - } - if (change === true) { - self.storeValue = {value: self.combo.getValue()}; - change = false; - } - self.combo.setValue(self.storeValue); - self.populate(); - + this.bigTip = BI.createWidget({ + type: "bi.label", + text: o.numTip, + height: o.height - 2, + invisible: true }); - this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { - if (isSearching()) { - self.trigger.stopEditing(); - self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); - }else{ - if (isPopupView()) { - self.trigger.stopEditing(); - self.storeValue = {value: self.combo.getValue()}; - if (clear === true) { - self.storeValue = {value: {}}; - } - self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); - } - } - clear = false; - change = false; + BI.createWidget({ + type: "bi.absolute", + element: this.bigEditor.element, + items: [{ + el: this.bigTip, + top: 0, + right: 5 + }] }); - var triggerBtn = BI.createWidget({ - type: "bi.trigger_icon_button", - width: o.height, - height: o.height, - cls: "multi-select-trigger-icon-button bi-border-left" + //this.smallCombo = BI.createWidget({ + // type: "bi.number_interval_combo", + // cls: "number-interval-small-combo", + // height: o.height, + // value: o.closemin ? 1 : 0, + // offsetStyle: "left" + //}); + // + //this.bigCombo = BI.createWidget({ + // type: "bi.number_interval_combo", + // cls: "number-interval-big-combo", + // height: o.height, + // value: o.closemax ? 1 : 0, + // offsetStyle: "left" + //}); + this.smallCombo = BI.createWidget({ + type: "bi.icon_combo", + cls: "number-interval-small-combo bi-border", + height: o.height - 2, + items: [{ + text: "(" + BI.i18nText("BI-Less_Than") + ")", + iconClass: "less-font", + value: 0 + }, { + text: "(" + BI.i18nText("BI-Less_And_Equal") + ")", + value: 1, + iconClass: "less-equal-font" + }] }); - triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { - self.trigger.getCounter().hideView(); - if (self.combo.isViewVisible()) { - self.combo.hideView(); - } else { - self.combo.showView(); - } + if (o.closemin === true) { + this.smallCombo.setValue(1); + } else { + this.smallCombo.setValue(0); + } + this.bigCombo = BI.createWidget({ + type: "bi.icon_combo", + cls: "number-interval-big-combo bi-border", + height: o.height - 2, + items: [{ + text: "(" + BI.i18nText("BI-Less_Than") + ")", + iconClass: "less-font", + value: 0 + }, { + text: "(" + BI.i18nText("BI-Less_And_Equal") + ")", + value: 1, + iconClass: "less-equal-font" + }] + }); + if (o.closemax === true) { + this.bigCombo.setValue(1); + } else { + this.bigCombo.setValue(0); + } + this.label = BI.createWidget({ + type: "bi.label", + text: BI.i18nText("BI-Basic_Value"), + textHeight: o.height - c.border * 2, + width: c.width - c.border * 2, + height: o.height - c.border * 2, + level: "warning", + tipType: "warning" + }); + this.left = BI.createWidget({ + type: "bi.htape", + items: [{ + el: self.smallEditor + }, { + el: self.smallCombo, + width: c.width - c.border * 2 + }] + }); - BI.createWidget({ - type: "bi.absolute", - element: this, + this.right = BI.createWidget({ + type: "bi.htape", items: [{ - el: this.combo, - left: 0, - right: 0, - top: 0, - bottom: 0 + el: self.bigCombo, + width: c.width - c.border * 2 }, { - el: triggerBtn, - right: 0, - top: 0, - bottom: 0 + el: self.bigEditor }] - }) - }, + }); - _defaultState: function () { - this.trigger.stopEditing(); - this.combo.hideView(); - }, - setValue: function (v) { - this.storeValue.value = v || {}; - this.combo.setValue({ - value: v || {} + BI.createWidget({ + element: self, + type: "bi.center", + hgap: 15, + height: o.height, + items: [ + { + type: "bi.absolute", + items: [{ + el: self.left, + left: -15, + right: 0, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: self.right, + left: 0, + right: -15, + top: 0, + bottom: 0 + }] + } + ] }); - }, - getValue: function () { - return this.storeValue.value; - }, + BI.createWidget({ + element: self, + type: "bi.horizontal_auto", + items: [ + self.label + ] + }); - populate: function () { - this.combo.populate.apply(this.combo, arguments); - } -}); -BI.MultiTreeCombo.EVENT_CONFIRM = "MultiTreeCombo.EVENT_CONFIRM"; + self._setValidEvent(self.bigEditor, c.bigEditor); + self._setValidEvent(self.smallEditor, c.smallEditor); + self._setErrorEvent(self.bigEditor, c.bigEditor); + self._setErrorEvent(self.smallEditor, c.smallEditor); + self._setBlurEvent(self.bigEditor); + self._setBlurEvent(self.smallEditor); + self._setFocusEvent(self.bigEditor); + self._setFocusEvent(self.smallEditor); + self._setComboValueChangedEvent(self.bigCombo); + self._setComboValueChangedEvent(self.smallCombo); + self._setEditorValueChangedEvent(self.bigEditor); + self._setEditorValueChangedEvent(self.smallEditor); + }, -BI.shortcut('bi.multi_tree_combo', BI.MultiTreeCombo);/** - * 带加载的多选下拉面板 - * @class BI.MultiTreePopup - * @extends BI.Pane - */ -BI.MultiTreePopup = BI.inherit(BI.Pane, { + _checkValidation: function () { + var self = this, c = this.constants, o = this.options; + self._setTitle(""); + BI.Bubbles.hide(c.typeError); + BI.Bubbles.hide(c.numberError); + BI.Bubbles.hide(c.signalError); + if (!self.smallEditor.isValid() || !self.bigEditor.isValid()) { + self.element.removeClass("number-error"); + o.validation = "invalid"; + return c.typeError; + } else { + if (BI.isEmptyString(self.smallEditor.getValue()) || BI.isEmptyString(self.bigEditor.getValue())) { + self.element.removeClass("number-error"); + o.validation = "valid"; + return ""; + } else { + var smallValue = parseFloat(self.smallEditor.getValue()), bigValue = parseFloat(self.bigEditor.getValue()), + bigComboValue = self.bigCombo.getValue(), smallComboValue = self.smallCombo.getValue(); + if (bigComboValue[0] === c.less_equal && smallComboValue[0] === c.less_equal) { + if (smallValue > bigValue) { + self.element.addClass("number-error"); + o.validation = "invalid"; + return c.numberError; + } else { + self.element.removeClass("number-error"); + o.validation = "valid"; + return ""; + } + } else { + if (smallValue > bigValue) { + self.element.addClass("number-error"); + o.validation = "invalid"; + return c.numberError; + } else if (smallValue === bigValue) { + self.element.addClass("number-error"); + o.validation = "invalid"; + return c.signalError; + } else { + self.element.removeClass("number-error"); + o.validation = "valid"; + return ""; + } + } + } - _defaultConfig: function () { - return BI.extend(BI.MultiTreePopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-tree-popup', - maxWidth: 'auto', - minWidth: 100, - maxHeight: 400, - onLoaded: BI.emptyFn - }); + } }, - _init: function () { - BI.MultiTreePopup.superclass._init.apply(this, arguments); + _setTitle: function (v) { + var self = this; + self.bigEditor.setTitle(v); + self.smallEditor.setTitle(v); + self.label.setTitle(v); + }, - var self = this, opts = this.options; + _setFocusEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.Editor.EVENT_FOCUS, function () { + self._setTitle(""); + switch (self._checkValidation()) { + case c.typeError: + BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { + offsetStyle: "center" + }); + break; + case c.numberError: + BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { + offsetStyle: "center" + }); + break; + case c.signalError: + BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { + offsetStyle: "center" + }); + break; + default : + return + } - this.selectedValues = {}; + }) + }, + _setBlurEvent: function (w) { + var c = this.constants, self = this; + w.on(BI.Editor.EVENT_BLUR, function () { + BI.Bubbles.hide(c.typeError); + BI.Bubbles.hide(c.numberError); + BI.Bubbles.hide(c.signalError); + switch (self._checkValidation()) { + case c.typeError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")); + break; + case c.numberError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")); + break; + case c.signalError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")); + break; + default: + self._setTitle(""); + } + }) + }, - this.tree = BI.createWidget({ - type: "bi.async_tree", - height: 400, - cls:"popup-view-tree", - itemsCreator: opts.itemsCreator, - onLoaded: opts.onLoaded - }); + _setErrorEvent: function (w) { + var c = this.constants, self = this + w.on(BI.Editor.EVENT_ERROR, function () { + self._checkValidation(); + BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.NumberInterval.EVENT_ERROR); + }) + }, - this.popupView = BI.createWidget({ - type: "bi.multi_popup_view", - element: this, - stopPropagation: false, - maxWidth: opts.maxWidth, - minWidth: opts.minWidth, - maxHeight: opts.maxHeight, - buttons: [BI.i18nText('BI-Basic_Clears'), BI.i18nText('BI-Basic_Sure')], - el: this.tree - }); - this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { - switch (index) { - case 0: - self.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CLEAR); + _setValidEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.Editor.EVENT_VALID, function () { + switch (self._checkValidation()) { + case c.numberError: + BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.NumberInterval.EVENT_ERROR); + break; + case c.signalError: + BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.NumberInterval.EVENT_ERROR); + break; + default: + self.fireEvent(BI.NumberInterval.EVENT_VALID); + } + }) + }, + + + _setEditorValueChangedEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.Editor.EVENT_CHANGE, function () { + switch (self._checkValidation()) { + case c.typeError: + BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { + offsetStyle: "center" + }); break; - case 1: - self.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CONFIRM); + case c.numberError: + BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { + offsetStyle: "center" + }); + break; + case c.signalError: + BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { + offsetStyle: "center" + }); + break; + default : break; } + self.fireEvent(BI.NumberInterval.EVENT_CHANGE); }); - - this.tree.on(BI.TreeView.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiTreePopup.EVENT_CHANGE); - }); - - this.tree.on(BI.TreeView.EVENT_AFTERINIT, function () { - self.fireEvent(BI.MultiTreePopup.EVENT_AFTERINIT); - }); - }, - getValue: function () { - return this.tree.getValue(); + _setComboValueChangedEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.IconCombo.EVENT_CHANGE, function () { + switch (self._checkValidation()) { + case c.typeError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")); + self.fireEvent(BI.NumberInterval.EVENT_ERROR); + break; + case c.numberError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")); + self.fireEvent(BI.NumberInterval.EVENT_ERROR); + break; + case c.signalError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")); + self.fireEvent(BI.NumberInterval.EVENT_ERROR); + break; + default : + self.fireEvent(BI.NumberInterval.EVENT_CHANGE); + self.fireEvent(BI.NumberInterval.EVENT_VALID); + } + }) }, - setValue: function (v) { - v || (v = {}); - this.tree.setSelectedValue(v.value); + isStateValid: function () { + return this.options.validation === "valid"; }, - populate: function (config) { - this.tree.stroke(config); + setMinEnable: function (b) { + this.smallEditor.setEnable(b); }, - hasChecked: function () { - return this.tree.hasChecked(); + setCloseMinEnable: function (b) { + this.smallCombo.setEnable(b); }, - resetHeight: function (h) { - this.popupView.resetHeight(h); + setMaxEnable: function (b) { + this.bigEditor.setEnable(b); }, - resetWidth: function (w) { - this.popupView.resetWidth(w); - } -}); - -BI.MultiTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.MultiTreePopup.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; -BI.MultiTreePopup.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; -BI.MultiTreePopup.EVENT_AFTERINIT = "EVENT_AFTERINIT"; - + setCloseMaxEnable: function (b) { + this.bigCombo.setEnable(b); + }, -BI.shortcut('bi.multi_tree_popup_view', BI.MultiTreePopup);/** - * - * 在搜索框中输入文本弹出的面板 - * @class BI.MultiTreeSearchPane - * @extends BI.Pane - */ + showNumTip: function () { + this.smallTip.setVisible(true); + this.bigTip.setVisible(true); + }, -BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { + hideNumTip: function () { + this.smallTip.setVisible(false); + this.bigTip.setVisible(false); + }, - _defaultConfig: function () { - return BI.extend(BI.MultiTreeSearchPane.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-multi-tree-search-pane bi-card", - itemsCreator: BI.emptyFn, - keywordGetter: BI.emptyFn - }); + setNumTip: function(numTip) { + this.smallTip.setText(numTip); + this.bigTip.setText(numTip); }, - _init: function () { - BI.MultiTreeSearchPane.superclass._init.apply(this, arguments); + getNumTip: function() { + return this.smallTip.getText(); + }, - var self = this, opts = this.options; + setValue: function (data) { + data = data || {}; + var self = this, combo_value; + if (BI.isNumeric(data.min) || BI.isEmptyString(data.min)) { + self.smallEditor.setValue(data.min); + } - this.partTree = BI.createWidget({ - type: "bi.part_tree", - element: this, - tipText: BI.i18nText("BI-No_Select"), - itemsCreator: function (op, callback) { - op.keyword = opts.keywordGetter(); - opts.itemsCreator(op, callback); - } - }); + if (!BI.isNotNull(data.min)) { + self.smallEditor.setValue(""); + } - this.partTree.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + if (BI.isNumeric(data.max) || BI.isEmptyString(data.max)) { + self.bigEditor.setValue(data.max); + } - this.partTree.on(BI.TreeView.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE); - }); - }, + if (!BI.isNotNull(data.max)) { + self.bigEditor.setValue(""); + } - hasChecked: function () { - return this.partTree.hasChecked(); - }, + if (!BI.isNull(data.closemin)) { + if (data.closemin === true) { + combo_value = 1 + } else { + combo_value = 0 + } + self.smallCombo.setValue(combo_value); + } - setValue: function (v) { - this.setSelectedValue(v.value); + if (!BI.isNull(data.closemax)) { + if (data.closemax === true) { + combo_value = 1 + } else { + combo_value = 0 + } + self.bigCombo.setValue(combo_value); + } }, - setSelectedValue: function (v) { - v || (v = {}); - this.partTree.setSelectedValue(v); - }, getValue: function () { - return this.partTree.getValue(); - }, - - empty: function () { - this.partTree.empty(); - }, + var self = this, value = {}, minComboValue = self.smallCombo.getValue(), maxComboValue = self.bigCombo.getValue(); + value.min = self.smallEditor.getValue(); + value.max = self.bigEditor.getValue(); + if (minComboValue[0] === 0) { + value.closemin = false + } else { + value.closemin = true + } - populate: function (op) { - this.partTree.stroke.apply(this.partTree, arguments); + if (maxComboValue[0] === 0) { + value.closemax = false + } else { + value.closemax = true + } + return value; } }); - -BI.MultiTreeSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; - -BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; -BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; - -BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);/** - * 查看已选按钮 - * Created by guy on 15/11/3. - * @class BI.MultiTreeCheckSelectedButton +BI.NumberInterval.EVENT_CHANGE = "EVENT_CHANGE"; +BI.NumberInterval.EVENT_VALID = "EVENT_VALID"; +BI.NumberInterval.EVENT_ERROR = "EVENT_ERROR"; +BI.shortcut("bi.number_interval", BI.NumberInterval);/** + * + * 表格 + * + * Created by GUY on 2015/9/22. + * @class BI.PageTableCell * @extends BI.Single */ -BI.MultiTreeCheckSelectedButton = BI.inherit(BI.Single, { - - _const: { - checkSelected: BI.i18nText('BI-Check_Selected') - }, - +BI.PageTableCell = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.MultiTreeCheckSelectedButton.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-tree-check-selected-button', - itemsCreator: BI.emptyFn - }); - }, - - _init: function () { - BI.MultiTreeCheckSelectedButton.superclass._init.apply(this, arguments); - var self = this; - this.indicator = BI.createWidget({ - type: 'bi.icon_button', - cls: 'check-font trigger-check-selected', - width: 15, - height: 15, - stopPropagation: true - }); - - this.checkSelected = BI.createWidget({ - type: 'bi.text_button', - cls: "trigger-check-selected", - invisible: true, - hgap: 4, - text: this._const.checkSelected, - textAlign: 'center', - textHeight: 15 - }); - this.checkSelected.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - - this.checkSelected.on(BI.TextButton.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE, arguments); - }); - - BI.createWidget({ - type: "bi.horizontal", - element: this, - items: [this.indicator, this.checkSelected] + return BI.extend(BI.PageTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-page-table-cell", + text: "", + title: "" }) + }, - this.element.hover(function () { - self.indicator.setVisible(false); - self.checkSelected.setVisible(true); - }, function () { - self.indicator.setVisible(true); - self.checkSelected.setVisible(false); + _init: function () { + BI.PageTableCell.superclass._init.apply(this, arguments); + var label = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "nowrap", + height: this.options.height, + text: this.options.text, + title: this.options.title, + value: this.options.value, + lgap: 5, + rgap: 5 }); - this.setVisible(false); - }, - setValue: function (v) { - v || (v = {}); - this.setVisible(BI.size(v.value) > 0); + if (BI.isNotNull(this.options.styles) && BI.isObject(this.options.styles)) { + this.element.css(this.options.styles); + } } }); -BI.MultiTreeCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut('bi.multi_tree_check_selected_button', BI.MultiTreeCheckSelectedButton);/** - * searcher - * Created by guy on 15/11/3. - * @class BI.MultiTreeSearcher - * @extends Widget +BI.shortcut("bi.page_table_cell", BI.PageTableCell);/** + * 分页表格 + * + * Created by GUY on 2016/2/15. + * @class BI.PageTable + * @extends BI.Widget */ -BI.MultiTreeSearcher = BI.inherit(BI.Widget, { - - _defaultConfig: function () { - return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this, arguments), { - baseCls: 'bi-multi-tree-searcher', - itemsCreator: BI.emptyFn, - popup: {}, +BI.PageTable = BI.inherit(BI.Widget, { - adapter: null, - masker: {} - }); + _const: { + scrollWidth: 18, + minScrollWidth: 100 }, - _init: function () { - BI.MultiTreeSearcher.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.editor = BI.createWidget({ - type: 'bi.multi_select_editor', - height: o.height, + _defaultConfig: function () { + return BI.extend(BI.PageTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-page-table", el: { - type: "bi.simple_state_editor", - height: o.height - } - }); - - this.searcher = BI.createWidget({ - type: "bi.searcher", - element: this, - isAutoSearch: false, - isAutoSync: false, - onSearch: function (op, callback) { - callback({ - keyword: self.editor.getValue() - }); + type: "bi.sequence_table" }, - el: this.editor, + pager: { + horizontal: { + pages: false, //总页数 + curr: 1, //初始化当前页, pages为数字时可用 - popup: BI.extend({ - type: "bi.multi_tree_search_pane", - keywordGetter: function () { - return self.editor.getValue(); + hasPrev: BI.emptyFn, + hasNext: BI.emptyFn, + firstPage: 1, + lastPage: BI.emptyFn }, - itemsCreator: function (op, callback) { - op.keyword = self.editor.getValue(); - o.itemsCreator(op, callback); + vertical: { + pages: false, //总页数 + curr: 1, //初始化当前页, pages为数字时可用 + + hasPrev: BI.emptyFn, + hasNext: BI.emptyFn, + firstPage: 1, + lastPage: BI.emptyFn } - }, o.popup), + }, - adapter: o.adapter, - masker: o.masker - }); - this.searcher.on(BI.Searcher.EVENT_START, function () { - self.fireEvent(BI.MultiTreeSearcher.EVENT_START); - }); - this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { - if (this.hasMatched()) { + itemsCreator: BI.emptyFn, - } - self.fireEvent(BI.MultiTreeSearcher.EVENT_PAUSE); - }); - this.searcher.on(BI.Searcher.EVENT_STOP, function () { - self.fireEvent(BI.MultiTreeSearcher.EVENT_STOP); - }); - this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { - self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); - }); - }, + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 - adjustView: function () { - this.searcher.adjustView(); - }, + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: BI.emptyFn, - setAdapter: function (adapter) { - this.searcher.setAdapter(adapter); - }, + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + rowSize: 25, - isSearching: function () { - return this.searcher.isSearching(); - }, + regionColumnSize: [], - stopSearch: function () { - this.searcher.stopSearch(); - }, + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, - getKeyword: function () { - return this.editor.getValue(); - }, + header: [], + items: [], //二维数组 - hasMatched: function () { - return this.searcher.hasMatched(); + //交叉表头 + crossHeader: [], + crossItems: [] + }); }, - hasChecked: function () { - return this.searcher.getView() && this.searcher.getView().hasChecked(); - }, + _init: function () { + BI.PageTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.hCurr = 1; + this.vCurr = 1; - setState: function (ob) { - ob || (ob = {}); - ob.value || (ob.value = []); - if (ob.type === BI.Selection.All) { - this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); - } else { - this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); - } - }, + this.table = BI.createWidget(o.el, { + type: "bi.sequence_table", + width: o.width, + height: o.height && o.height - 30, - setValue: function (ob) { - this.setState(ob); - this.searcher.setValue(ob); - }, + isNeedResize: true, + isResizeAdapt: false, - getKey: function () { - return this.editor.getValue(); - }, + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, - getValue: function () { - return this.searcher.getValue(); - }, + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, - populate: function (items) { - this.searcher.populate.apply(this.searcher, arguments); - } -}); + columnSize: o.columnSize, + minColumnSize: o.minColumnSize, + maxColumnSize: o.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, -BI.MultiTreeSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; -BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE"; -BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; -BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; -BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; -BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);/** - * Created by windy on 2017/3/13. - * 数值微调器 - */ -BI.NumberEditor = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.NumberEditor.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-number-editor bi-border", - validationChecker: function () { - return true; - }, - valueFormatter: function (v) { - return v; - }, - value: 0, - allowBlank: false, - errorText: "", - step: 1 - }) - }, + regionColumnSize: o.regionColumnSize, - _init: function () { - BI.NumberEditor.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.editor = BI.createWidget({ - type: "bi.sign_editor", - height: o.height, - allowBlank: o.allowBlank, - value: o.valueFormatter(o.value), - validationChecker: o.validationChecker, - errorText: o.errorText - }); - this.editor.on(BI.TextEditor.EVENT_CHANGE, function () { - o.value = this.getValue(); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); + headerCellStyleGetter: o.headerCellStyleGetter, + summaryCellStyleGetter: o.summaryCellStyleGetter, + sequenceCellStyleGetter: o.sequenceCellStyleGetter, + + header: o.header, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems }); - this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); }); - this.topBtn = BI.createWidget({ - type: "bi.icon_button", - trigger: "lclick,", - cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom" + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); }); - this.topBtn.on(BI.IconButton.EVENT_CHANGE, function () { - self._finetuning(o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); }); - this.bottomBtn = BI.createWidget({ - type: "bi.icon_button", - trigger: "lclick,", - cls: "column-next-page-h-font bottom-button bi-border-left bi-border-top" + + this.pager = BI.createWidget(o.pager, { + type: "bi.direction_pager", + height: 30 }); - this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function () { - self._finetuning(-o.step); - self.fireEvent(BI.NumberEditor.EVENT_CHANGE); - self.fireEvent(BI.NumberEditor.EVENT_CONFIRM); + this.pager.on(BI.Pager.EVENT_CHANGE, function () { + var vpage = this.getVPage && this.getVPage(); + if (BI.isNull(vpage)) { + vpage = this.getCurrentPage(); + } + var hpage = this.getHPage && this.getHPage(); + o.itemsCreator({ + vpage: vpage, + hpage: hpage + }, function (items, header, crossItems, crossHeader) { + self.table.setVPage ? self.table.setVPage(vpage) : self.table.setValue(vpage); + self.table.setHPage && self.table.setHPage(hpage); + self.populate.apply(self, arguments); + }); }); + BI.createWidget({ - type: "bi.htape", + type: "bi.absolute", 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: 23 + items: [{ + el: this.table, + left: 0, + top: 0 + }, { + el: this.pager, + left: 0, + right: 0, + bottom: 0 }] - }); + }) }, - //微调 - _finetuning: function (add) { - var v = BI.parseFloat(this.getValue()); - this.setValue(v.add(add)); + setHPage: function (v) { + this.hCurr = v; + this.pager.setHPage && this.pager.setHPage(v); + this.table.setHPage && this.table.setHPage(v); }, - setUpEnable: function (v) { - this.topBtn.setEnable(!!v); + setVPage: function (v) { + this.vCurr = v; + this.pager.setVPage && this.pager.setVPage(v); + this.table.setVPage && this.table.setVPage(v); }, - setDownEnable: function (v) { - this.bottomBtn.setEnable(!!v); + getHPage: function () { + var hpage = this.pager.getHPage && this.pager.getHPage(); + if (BI.isNotNull(hpage)) { + return hpage; + } + hpage = this.pager.getCurrentPage && this.pager.getCurrentPage(); + if (BI.isNotNull(hpage)) { + return hpage; + } + return this.hpage; }, - getValue: function () { - return this.options.value; + getVPage: function () { + var vpage = this.pager.getVPage && this.pager.getVPage(); + if (BI.isNotNull(vpage)) { + return vpage; + } + vpage = this.pager.getCurrentPage && this.pager.getCurrentPage(); + if (BI.isNotNull(vpage)) { + return vpage; + } + return this.vpage; }, - setValue: function (v) { - var o = this.options; - o.value = v; - this.editor.setValue(o.valueFormatter(v)); - } + setWidth: function (width) { + BI.PageTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, -}); -BI.NumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.NumberEditor.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.number_editor", BI.NumberEditor);//小于号的值为:0,小于等于号的值为:1 -//closeMIn:最小值的符号,closeMax:最大值的符号 -/** - * Created by roy on 15/9/17. - * - */ -BI.NumberInterval = BI.inherit(BI.Single, { - constants: { - typeError: "typeBubble", - numberError: "numberBubble", - signalError: "signalBubble", - editorWidth: 114, - columns: 5, - width: 30, - rows: 1, - numberErrorCls: "number-error", - border: 1, - less: 0, - less_equal: 1, - numTip: "" + setHeight: function (height) { + BI.PageTable.superclass.setHeight.apply(this, arguments); + var showPager = false; + if (this.pager.alwaysShowPager) { + showPager = true; + } else if (this.pager.hasHNext && this.pager.hasHNext()) { + showPager = true; + } else if (this.pager.hasHPrev && this.pager.hasHPrev()) { + showPager = true; + } else if (this.pager.hasVNext && this.pager.hasVNext()) { + showPager = true; + } else if (this.pager.hasVPrev && this.pager.hasVPrev()) { + showPager = true; + } else if (this.pager.hasNext && this.pager.hasNext()) { + showPager = true; + } else if (this.pager.hasPrev && this.pager.hasPrev()) { + showPager = true; + } + this.table.setHeight(height - (showPager ? 30 : 0)); }, - _defaultConfig: function () { - var conf = BI.NumberInterval.superclass._defaultConfig.apply(this, arguments) - return BI.extend(conf, { - extraCls: "bi-number-interval", - height: 25, - validation: "valid" - }) + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setColumnSize(columnSize); }, - _init: function () { - var self = this, c = this.constants, o = this.options; - BI.NumberInterval.superclass._init.apply(this, arguments) - this.smallEditor = BI.createWidget({ - type: "bi.editor", - height: o.height - 2, - watermark: BI.i18nText("BI-Basic_Unrestricted"), - allowBlank: true, - value: o.min, - level: "warning", - tipType: "warning", - quitChecker: function () { - return false; - }, - validationChecker: function (v) { - if (!BI.isNumeric(v)) { - self.smallEditorBubbleType = c.typeError; - return false; - } - return true; - }, - cls: "number-interval-small-editor bi-border-top bi-border-bottom bi-border-left" - }); - this.smallTip = BI.createWidget({ - type: "bi.label", - text: o.numTip, - height: o.height - 2, - invisible: true - }); - BI.createWidget({ - type: "bi.absolute", - element: this.smallEditor.element, - items: [{ - el: this.smallTip, - top: 0, - right: 5 - }] - }); + getColumnSize: function () { + return this.table.getColumnSize(); + }, - this.bigEditor = BI.createWidget({ - type: "bi.editor", - height: o.height - 2, - watermark: BI.i18nText("BI-Basic_Unrestricted"), - allowBlank: true, - value: o.max, - level: "warning", - tipType: "warning", - quitChecker: function () { - return false; - }, - validationChecker: function (v) { - if (!BI.isNumeric(v)) { - self.bigEditorBubbleType = c.typeError; - return false; - } - return true; - }, - cls: "number-interval-big-editor bi-border-top bi-border-bottom bi-border-right" - }); + setRegionColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, - this.bigTip = BI.createWidget({ - type: "bi.label", - text: o.numTip, - height: o.height - 2, - invisible: true - }); - BI.createWidget({ - type: "bi.absolute", - element: this.bigEditor.element, - items: [{ - el: this.bigTip, - top: 0, - right: 5 - }] - }); + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, - //this.smallCombo = BI.createWidget({ - // type: "bi.number_interval_combo", - // cls: "number-interval-small-combo", - // height: o.height, - // value: o.closemin ? 1 : 0, - // offsetStyle: "left" - //}); - // - //this.bigCombo = BI.createWidget({ - // type: "bi.number_interval_combo", - // cls: "number-interval-big-combo", - // height: o.height, - // value: o.closemax ? 1 : 0, - // offsetStyle: "left" - //}); - this.smallCombo = BI.createWidget({ - type: "bi.icon_combo", - cls: "number-interval-small-combo bi-border", - height: o.height - 2, - items: [{ - text: "(" + BI.i18nText("BI-Less_Than") + ")", - iconClass: "less-font", - value: 0 - }, { - text: "(" + BI.i18nText("BI-Less_And_Equal") + ")", - value: 1, - iconClass: "less-equal-font" - }] - }); - if (o.closemin === true) { - this.smallCombo.setValue(1); - } else { - this.smallCombo.setValue(0); - } - this.bigCombo = BI.createWidget({ - type: "bi.icon_combo", - cls: "number-interval-big-combo bi-border", - height: o.height - 2, - items: [{ - text: "(" + BI.i18nText("BI-Less_Than") + ")", - iconClass: "less-font", - value: 0 - }, { - text: "(" + BI.i18nText("BI-Less_And_Equal") + ")", - value: 1, - iconClass: "less-equal-font" - }] - }); - if (o.closemax === true) { - this.bigCombo.setValue(1); - } else { - this.bigCombo.setValue(0); - } - this.label = BI.createWidget({ - type: "bi.label", - text: BI.i18nText("BI-Basic_Value"), - textHeight: o.height - c.border * 2, - width: c.width - c.border * 2, - height: o.height - c.border * 2, - level: "warning", - tipType: "warning" - }); - this.left = BI.createWidget({ - type: "bi.htape", - items: [{ - el: self.smallEditor - }, { - el: self.smallCombo, - width: c.width - c.border * 2 - }] + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, - }); - this.right = BI.createWidget({ - type: "bi.htape", - items: [{ - el: self.bigCombo, - width: c.width - c.border * 2 - }, { - el: self.bigEditor - }] - }); + restore: function () { + this.table.restore(); + }, + attr: function () { + BI.PageTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + }, - BI.createWidget({ - element: self, - type: "bi.center", - hgap: 15, - height: o.height, - items: [ - { - type: "bi.absolute", - items: [{ - el: self.left, - left: -15, - right: 0, - top: 0, - bottom: 0 - }] - }, { - type: "bi.absolute", - items: [{ - el: self.right, - left: 0, - right: -15, - top: 0, - bottom: 0 - }] - } - ] - }); + populate: function () { + this.pager.populate(); + this.table.populate.apply(this.table, arguments); + }, - BI.createWidget({ - element: self, - type: "bi.horizontal_auto", - items: [ - self.label - ] - }); + destroy: function () { + this.table.destroy(); + this.pager && this.pager.destroy(); + BI.PageTable.superclass.destroy.apply(this, arguments); + } +}); +BI.shortcut('bi.page_table', BI.PageTable);/** + * 路径选择 + * + * Created by GUY on 2015/12/4. + * @class BI.PathChooser + * @extends BI.Widget + */ +BI.PathChooser = BI.inherit(BI.Widget, { + _const: { + lineColor: "#d4dadd", + selectLineColor: "#3f8ce8" + }, - self._setValidEvent(self.bigEditor, c.bigEditor); - self._setValidEvent(self.smallEditor, c.smallEditor); - self._setErrorEvent(self.bigEditor, c.bigEditor); - self._setErrorEvent(self.smallEditor, c.smallEditor); - self._setBlurEvent(self.bigEditor); - self._setBlurEvent(self.smallEditor); - self._setFocusEvent(self.bigEditor); - self._setFocusEvent(self.smallEditor); - self._setComboValueChangedEvent(self.bigCombo); - self._setComboValueChangedEvent(self.smallCombo); - self._setEditorValueChangedEvent(self.bigEditor); - self._setEditorValueChangedEvent(self.smallEditor); + _defaultConfig: function () { + return BI.extend(BI.PathChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-path-chooser", + items: [] + }) }, - _checkValidation: function () { - var self = this, c = this.constants, o = this.options; - self._setTitle(""); - BI.Bubbles.hide(c.typeError); - BI.Bubbles.hide(c.numberError); - BI.Bubbles.hide(c.signalError); - if (!self.smallEditor.isValid() || !self.bigEditor.isValid()) { - self.element.removeClass("number-error"); - o.validation = "invalid"; - return c.typeError; - } else { - if (BI.isEmptyString(self.smallEditor.getValue()) || BI.isEmptyString(self.bigEditor.getValue())) { - self.element.removeClass("number-error"); - o.validation = "valid"; - return ""; - } else { - var smallValue = parseFloat(self.smallEditor.getValue()), bigValue = parseFloat(self.bigEditor.getValue()), - bigComboValue = self.bigCombo.getValue(), smallComboValue = self.smallCombo.getValue(); - if (bigComboValue[0] === c.less_equal && smallComboValue[0] === c.less_equal) { - if (smallValue > bigValue) { - self.element.addClass("number-error"); - o.validation = "invalid"; - return c.numberError; - } else { - self.element.removeClass("number-error"); - o.validation = "valid"; - return ""; - } - } else { - if (smallValue > bigValue) { - self.element.addClass("number-error"); - o.validation = "invalid"; - return c.numberError; - } else if (smallValue === bigValue) { - self.element.addClass("number-error"); - o.validation = "invalid"; - return c.signalError; - } else { - self.element.removeClass("number-error"); - o.validation = "valid"; - return ""; - } - } + _init: function () { + BI.PathChooser.superclass._init.apply(this, arguments); + this.populate(this.options.items); + }, + + _createRegions: function (regions) { + var self = this; + this.regions = BI.createWidgets(BI.map(regions, function (i, region) { + return { + type: "bi.path_region", + title: self.texts[region] || region } + })); + this.regionMap = {}; + BI.each(regions, function (i, region) { + self.regionMap[region] = i; + }); + this.container = BI.createWidget({ + type: "bi.horizontal", + verticalAlign: "top", + scrollx: false, + scrolly: false, + hgap: 10, + items: this.regions + }); + BI.createWidget({ + type: "bi.vertical_adapt", + element: this, + scrollable: true, + hgap: 10, + items: [this.container] + }); + }, + getRegionIndexById: function (id) { + var node = this.cache[id]; + var regionType = node.get("region"); + return this.regionMap[regionType]; + }, + + _drawPath: function (start, offset, index) { + var self = this; + var starts = []; + if (BI.contains(this.start, start)) { + starts = this.start; + } else { + starts = [start]; + } + + BI.each(starts, function (i, s) { + BI.each(self.radios[s], function (i, rad) { + rad.setSelected(false); + }); + BI.each(self.lines[s], function (i, line) { + line.attr("stroke", self._const.lineColor); + }); + BI.each(self.regionIndexes[s], function (i, idx) { + self.regions[idx].reset(); + }); + }); + + BI.each(this.routes[start][index], function (i, id) { + var regionIndex = self.getRegionIndexById(id); + self.regions[regionIndex].setSelect(offset + index, id); + }); + var current = BI.last(this.routes[start][index]); + + while (current && this.routes[current] && this.routes[current].length === 1) { + BI.each(this.routes[current][0], function (i, id) { + var regionIndex = self.getRegionIndexById(id); + self.regions[regionIndex].setSelect(0, id); + }); + this.lines[current][0].attr("stroke", self._const.selectLineColor).toFront(); + current = BI.last(this.routes[current][0]); } + this.lines[start][index].attr("stroke", self._const.selectLineColor).toFront(); + this.radios[start] && this.radios[start][index] && this.radios[start][index].setSelected(true); }, - _setTitle: function (v) { + _drawRadio: function (start, offset, index, x, y) { var self = this; - self.bigEditor.setTitle(v); - self.smallEditor.setTitle(v); - self.label.setTitle(v); + var radio = BI.createWidget({ + type: "bi.radio", + cls: "path-chooser-radio", + selected: offset + index === 0, + start: start, + index: index + }); + radio.on(BI.Radio.EVENT_CHANGE, function () { + self._drawPath(start, offset, index); + self.fireEvent(BI.PathChooser.EVENT_CHANGE, start, index); + }); + if (!this.radios[start]) { + this.radios[start] = []; + } + this.radios[start].push(radio); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: [{ + el: radio, + left: x - 6.5, + top: y - 6.5 + }] + }) }, - _setFocusEvent: function (w) { - var self = this, c = this.constants; - w.on(BI.Editor.EVENT_FOCUS, function () { - self._setTitle(""); - switch (self._checkValidation()) { - case c.typeError: - BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { - offsetStyle: "center" - }); - break; - case c.numberError: - BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { - offsetStyle: "center" - }); - break; - case c.signalError: - BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { - offsetStyle: "center" - }); - break; - default : - return + _drawLine: function (start, lines) { + var self = this; + if (!this.lines[start]) { + this.lines[start] = []; + } + if (!this.pathes[start]) { + this.pathes[start] = []; + } + var startRegionIndex = this.getRegionIndexById(start); + //start所在的位置,然后接着往下画其他的路径 + var offset = this.regions[startRegionIndex].getIndexByValue(start); + BI.each(lines, function (i, line) { + self.pathes[start][i] = []; + var idx = i + offset; + var path = ""; + var stop = 47.5 + 29 * idx; + var sleft = 50 + 100 * startRegionIndex; + var radioStartX = sleft, radioStartY = stop; + var etop = stop; + var endRegionIndex = self.getRegionIndexById(BI.last(line)); + var endOffset = self.regions[endRegionIndex].getIndexByValue(BI.last(line)); + var eleft = 50 + 100 * endRegionIndex; + if (BI.contains(self.start, start)) { + radioStartX = sleft - 50; + path += "M" + (sleft - 50) + "," + stop; + self.pathes[start][i].push({ + x: sleft - 50, + y: stop + }) + } else if (idx === 0) { + radioStartX = sleft + 50; + path += "M" + sleft + "," + stop; + self.pathes[start][i].push({ + x: sleft, + y: stop + }) + } else { + radioStartX = sleft + 50; + path += "M" + sleft + "," + 47.5 + "L" + (sleft + 50) + "," + 47.5 + "L" + (sleft + 50) + "," + stop; + self.pathes[start][i].push({ + x: sleft, + y: 47.5 + }); + self.pathes[start][i].push({ + x: sleft + 50, + y: 47.5 + }); + self.pathes[start][i].push({ + x: sleft + 50, + y: stop + }); + } + if (idx > 0) { + var endY = endOffset * 29 + 47.5; + path += "L" + (eleft - 50) + "," + etop + "L" + (eleft - 50) + "," + endY + "L" + eleft + "," + endY; + self.pathes[start][i].push({ + x: eleft - 50, + y: etop + }); + self.pathes[start][i].push({ + x: eleft - 50, + y: endY + }); + self.pathes[start][i].push({ + x: eleft, + y: endY + }); + } else { + path += "L" + eleft + "," + etop; + self.pathes[start][i].push({ + x: eleft, + y: etop + }); } - }) + var graph = self.svg.path(path) + .attr({ + stroke: idx === 0 ? self._const.selectLineColor : self._const.lineColor, + 'stroke-dasharray': '-' + }); + self.lines[start].push(graph); + if (lines.length > 1) { + self.lines[start][0].toFront(); + } + //第一个元素无论有多少个都要显示radio + if (BI.contains(self.start, start)) { + self.lines[self.regions[0].getValueByIndex(0)][0].toFront(); + } + if (lines.length > 1 || BI.contains(self.start, start)) { + self._drawRadio(start, offset, i, radioStartX, radioStartY); + } + }); }, - _setBlurEvent: function (w) { - var c = this.constants, self = this; - w.on(BI.Editor.EVENT_BLUR, function () { - BI.Bubbles.hide(c.typeError); - BI.Bubbles.hide(c.numberError); - BI.Bubbles.hide(c.signalError); - switch (self._checkValidation()) { - case c.typeError: - self._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")); - break; - case c.numberError: - self._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")); - break; - case c.signalError: - self._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")); - break; - default: - self._setTitle(""); + + _drawLines: function (routes) { + var self = this; + this.lines = {}; + this.pathes = {}; + this.radios = {}; + this.regionIndexes = {}; + BI.each(routes, function (k, route) { + if (!self.regionIndexes[k]) { + self.regionIndexes[k] = []; } - }) + BI.each(route, function (i, rs) { + BI.each(rs, function (j, id) { + var regionIndex = self.getRegionIndexById(id); + if (!BI.contains(self.regionIndexes[k], regionIndex)) { + self.regionIndexes[k].push(regionIndex); + } + }); + }) + }); + BI.each(routes, function (k, route) { + self._drawLine(k, route); + }); }, - _setErrorEvent: function (w) { - var c = this.constants, self = this - w.on(BI.Editor.EVENT_ERROR, function () { - self._checkValidation(); - BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.NumberInterval.EVENT_ERROR); - }) + _pushNodes: function (nodes) { + var self = this; + var indexes = []; + for (var i = 0; i < nodes.length; i++) { + var id = nodes[i]; + var index = self.getRegionIndexById(id); + indexes.push(index); + var region = self.regions[index]; + if (i === nodes.length - 1) { + if (!region.hasItem(id)) { + region.addItem(id, self.texts[id]); + } + break; + } + if (i > 0 || BI.contains(self.start, id)) { + region.addItem(id, self.texts[id]); + } + } + for (var i = BI.first(indexes); i < BI.last(indexes); i++) { + if (!BI.contains(indexes, i)) { + self.regions[i].addItem(""); + } + } }, + _createNodes: function () { + var self = this, o = this.options; + this.cache = {}; + this.texts = {}; + this.start = []; + this.end = []; + BI.each(o.items, function (i, item) { + self.start.push(BI.first(item).value); + self.end.push(BI.last(item).value); + }); + this.start = BI.uniq(this.start); + this.end = BI.uniq(this.end); + var regions = []; + var tree = new BI.Tree(); + var branches = {}, max = 0; + BI.each(o.items, function (i, items) { + BI.each(items, function (j, item) { + if (!BI.has(branches, item.value)) { + branches[item.value] = 0; + } + branches[item.value]++; + max = Math.max(max, branches[item.value]); + var prev = {}; + if (j > 0) { + prev = items[j - 1]; + } + var parent = self.cache[prev.value || ""]; + var node = self.cache[item.value] || new BI.Node(item.value); + node.set(item); + self.cache[item.value] = node; + self.texts[item.value] = item.text; + self.texts[item.region] = item.regionText; + parent = BI.isNull(parent) ? tree.getRoot() : parent; + if (parent.getChildIndex(item.value) === -1) { + tree.addNode(parent, node); + } + }) + }); - _setValidEvent: function (w) { - var self = this, c = this.constants; - w.on(BI.Editor.EVENT_VALID, function () { - switch (self._checkValidation()) { - case c.numberError: - BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.NumberInterval.EVENT_ERROR); - break; - case c.signalError: - BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.NumberInterval.EVENT_ERROR); - break; - default: - self.fireEvent(BI.NumberInterval.EVENT_VALID); - } - }) - }, + //算出区域列表 + tree.traverse(function (node) { + BI.each(node.getChildren(), function (i, child) { + if (BI.contains(regions, child.get("region"))) { + var index1 = BI.indexOf(regions, node.get("region")); + var index2 = BI.indexOf(regions, child.get("region")); + //交换区域 + if (index1 > index2) { + var t = regions[index2]; + for (var j = index2; j < index1; j++) { + regions[j] = regions[j + 1]; + } + regions[index1] = t; + } + } else { + regions.push(child.get("region")); + } + }); + }); + this._createRegions(regions); + //算出节点 + BI.each(branches, function (k, branch) { + if (branch < max) { + delete branches[k]; + } + }); - _setEditorValueChangedEvent: function (w) { - var self = this, c = this.constants; - w.on(BI.Editor.EVENT_CHANGE, function () { - switch (self._checkValidation()) { - case c.typeError: - BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { - offsetStyle: "center" - }); - break; - case c.numberError: - BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { - offsetStyle: "center" - }); - break; - case c.signalError: - BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { - offsetStyle: "center" - }); - break; - default : - break; + //过滤节点 + var nodes = []; + var n = tree.getRoot(); + while (n && n.getChildrenLength() === 1) { + if (BI.has(branches, n.getChildren()[0].id)) { + delete branches[n.getChildren()[0].id]; + n = n.getChildren()[0]; + } else { + n = null; + } + } + tree.traverse(function (node) { + if (BI.has(branches, node.id)) { + nodes.push(node.id); + delete branches[node.id]; } - self.fireEvent(BI.NumberInterval.EVENT_CHANGE); }); - }, - _setComboValueChangedEvent: function (w) { - var self = this, c = this.constants; - w.on(BI.IconCombo.EVENT_CHANGE, function () { - switch (self._checkValidation()) { - case c.typeError: - self._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")); - self.fireEvent(BI.NumberInterval.EVENT_ERROR); - break; - case c.numberError: - self._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")); - self.fireEvent(BI.NumberInterval.EVENT_ERROR); - break; - case c.signalError: - self._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")); - self.fireEvent(BI.NumberInterval.EVENT_ERROR); - break; - default : - self.fireEvent(BI.NumberInterval.EVENT_CHANGE); - self.fireEvent(BI.NumberInterval.EVENT_VALID); + //填充节点 + var routes = {}; + var s, e; + for (var i = 0, len = nodes.length; i < len + 1; i++) { + if (len === 0) { + s = []; + BI.each(this.start, function (i, id) { + s.push(tree.search(id)); + }); + e = []; + BI.each(this.end, function (i, id) { + e.push(tree.search(id)); + }); + } else if (i === len) { + s = e; + e = []; + BI.each(this.end, function (i, id) { + e.push(tree.search(id)); + }); + } else if (i === 0) { + s = []; + BI.each(this.start, function (i, id) { + s.push(tree.search(id)); + }); + e = [tree.search(nodes[i])]; + } else { + s = [tree.search(e[0] || tree.getRoot(), nodes[i - 1])]; + e = [tree.search(s[0], nodes[i])]; } - }) + BI.each(s, function (i, n) { + tree._recursion(n, [n.id], function (node, route) { + if (BI.contains(e, node)) { + if (!routes[n.id]) { + routes[n.id] = []; + } + routes[n.id].push(route); + self._pushNodes(route); + if (e.length <= 1) { + return true; + } + } + }) + }); + } + this.routes = routes; + this._drawLines(routes); }, - isStateValid: function () { - return this.options.validation === "valid"; + _unselectAllPath: function () { + var self = this; + BI.each(this.radios, function (idx, rad) { + BI.each(rad, function (i, r) { + r.setSelected(false); + }); + }); + BI.each(this.lines, function (idx, line) { + BI.each(line, function (i, li) { + li.attr("stroke", self._const.lineColor); + }); + }); + BI.each(this.regions, function (idx, region) { + region.reset(); + }); }, - setMinEnable: function (b) { - this.smallEditor.setEnable(b); + populate: function (items) { + this.options.items = items || []; + var self = this; + this.empty(); + if (this.options.items.length <= 0) { + return; + } + this.svg = BI.createWidget({ + type: "bi.svg" + }); + this._createNodes(); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: [{ + el: this.svg, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }); }, - setCloseMinEnable: function (b) { - this.smallCombo.setEnable(b); + setValue: function (v) { + this._unselectAllPath(); + var nodes = BI.keys(this.routes), self = this; + var result = [], array = []; + BI.each(v, function (i, val) { + if (BI.contains(nodes, val)) { + if (array.length > 0) { + array.push(val); + result.push(array); + array = []; + } + } + array.push(val); + }); + if (array.length > 0) { + result.push(array); + } + //画这n条路径 + BI.each(result, function (idx, path) { + var start = path[0]; + var index = BI.findIndex(self.routes[start], function (idx, p) { + if (BI.isEqual(path, p)) { + return true; + } + }); + if (index >= 0) { + var startRegionIndex = self.getRegionIndexById(start); + var offset = self.regions[startRegionIndex].getIndexByValue(start); + self._drawPath(start, offset, index); + } + }); }, - setMaxEnable: function (b) { - this.bigEditor.setEnable(b); - }, + getValue: function () { + var path = []; + BI.each(this.regions, function (i, region) { + var val = region.getValue(); + if (BI.isKey(val)) { + path.push(val); + } + }); + return path; + } +}); +BI.PathChooser.EVENT_CHANGE = "PathChooser.EVENT_CHANGE"; +BI.shortcut("bi.path_chooser", BI.PathChooser);/** + * 路径选择区域 + * + * Created by GUY on 2015/12/4. + * @class BI.PathRegion + * @extends BI.Widget + */ +BI.PathRegion = BI.inherit(BI.Widget, { - setCloseMaxEnable: function (b) { - this.bigCombo.setEnable(b); + _defaultConfig: function () { + return BI.extend(BI.PathRegion.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-path-region bi-background", + width: 80, + title: "" + }) }, - showNumTip: function () { - this.smallTip.setVisible(true); - this.bigTip.setVisible(true); + _init: function () { + BI.PathRegion.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.zIndex = 100; + var title = BI.createWidget({ + type: "bi.label", + text: o.title, + title: o.title, + height: 30 + }); + title.element.css("zIndex", this.zIndex--); + this.items = []; + this.vertical = BI.createWidget({ + type: "bi.vertical", + element: this, + bgap: 5, + hgap: 10, + items: [title] + }) }, - hideNumTip: function () { - this.smallTip.setVisible(false); - this.bigTip.setVisible(false); + hasItem: function (val) { + return BI.any(this.items, function (i, item) { + return val === item.getValue(); + }); }, - setNumTip: function(numTip) { - this.smallTip.setText(numTip); - this.bigTip.setText(numTip); + addItem: function (value, text) { + if (BI.isKey(value)) { + var label = BI.createWidget({ + type: "bi.label", + cls: "path-region-label bi-card bi-border bi-list-item-select", + text: text, + value: value, + title: text || value, + height: 24 + }); + } else { + var label = BI.createWidget({ + type: "bi.layout", + height: 24 + }); + } + label.element.css("zIndex", this.zIndex--); + this.items.push(label); + this.vertical.addItem(label); + if (this.items.length === 1) { + this.setSelect(0, value); + } }, - getNumTip: function() { - return this.smallTip.getText(); + reset: function () { + BI.each(this.items, function (i, item) { + item.element.removeClass("active"); + }); }, - setValue: function (data) { - data = data || {}; - var self = this, combo_value; - if (BI.isNumeric(data.min) || BI.isEmptyString(data.min)) { - self.smallEditor.setValue(data.min); - } - - if (!BI.isNotNull(data.min)) { - self.smallEditor.setValue(""); + setSelect: function (index, value) { + this.reset(); + if (this.items.length <= 0) { + return; } - - if (BI.isNumeric(data.max) || BI.isEmptyString(data.max)) { - self.bigEditor.setValue(data.max); + if (this.items.length === 1) { + this.items[0].element.addClass("active"); + return; } - - if (!BI.isNotNull(data.max)) { - self.bigEditor.setValue(""); + if (this.items[index].attr("value") === value) { + this.items[index].element.addClass("active"); } + }, - if (!BI.isNull(data.closemin)) { - if (data.closemin === true) { - combo_value = 1 - } else { - combo_value = 0 - } - self.smallCombo.setValue(combo_value); - } + setValue: function (value) { + this.setSelect(this.getIndexByValue(value), value); + }, - if (!BI.isNull(data.closemax)) { - if (data.closemax === true) { - combo_value = 1 - } else { - combo_value = 0 - } - self.bigCombo.setValue(combo_value); - } + getValueByIndex: function (idx) { + return this.items[idx].attr("value"); }, + getIndexByValue: function (value) { + return BI.findIndex(this.items, function (i, item) { + return item.attr("value") === value; + }); + }, getValue: function () { - var self = this, value = {}, minComboValue = self.smallCombo.getValue(), maxComboValue = self.bigCombo.getValue(); - value.min = self.smallEditor.getValue(); - value.max = self.bigEditor.getValue(); - if (minComboValue[0] === 0) { - value.closemin = false - } else { - value.closemin = true - } - - if (maxComboValue[0] === 0) { - value.closemax = false - } else { - value.closemax = true - } - return value; + var res; + BI.any(this.items, function (i, item) { + if (item.element.hasClass("active")) { + res = item.getValue(); + return true; + } + }); + return res; } }); -BI.NumberInterval.EVENT_CHANGE = "EVENT_CHANGE"; -BI.NumberInterval.EVENT_VALID = "EVENT_VALID"; -BI.NumberInterval.EVENT_ERROR = "EVENT_ERROR"; -BI.shortcut("bi.number_interval", BI.NumberInterval);/** - * - * 表格 +BI.PathRegion.EVENT_CHANGE = "PathRegion.EVENT_CHANGE"; +BI.shortcut("bi.path_region", BI.PathRegion);/** + * 预览表列 * - * Created by GUY on 2015/9/22. - * @class BI.PageTableCell - * @extends BI.Single + * Created by GUY on 2015/12/25. + * @class BI.PreviewTableCell + * @extends BI.Widget */ -BI.PageTableCell = BI.inherit(BI.Widget, { +BI.PreviewTableCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { - return BI.extend(BI.PageTableCell.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-page-table-cell", - text: "", - title: "" - }) + return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-preview-table-cell", + text: "" + }); }, _init: function () { - BI.PageTableCell.superclass._init.apply(this, arguments); - var label = BI.createWidget({ + BI.PreviewTableCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + BI.createWidget({ type: "bi.label", element: this, textAlign: "left", - whiteSpace: "nowrap", + whiteSpace: "normal", height: this.options.height, text: this.options.text, - title: this.options.title, - value: this.options.value, - lgap: 5, - rgap: 5 - }); - - if (BI.isNotNull(this.options.styles) && BI.isObject(this.options.styles)) { - this.element.css(this.options.styles); - } + value: this.options.value + }) } }); - -BI.shortcut("bi.page_table_cell", BI.PageTableCell);/** - * 分页表格 +BI.shortcut('bi.preview_table_cell', BI.PreviewTableCell);/** + * 预览表 * - * Created by GUY on 2016/2/15. - * @class BI.PageTable + * Created by GUY on 2015/12/25. + * @class BI.PreviewTableHeaderCell * @extends BI.Widget */ -BI.PageTable = BI.inherit(BI.Widget, { - - _const: { - scrollWidth: 18, - minScrollWidth: 100 - }, - - _defaultConfig: function () { - return BI.extend(BI.PageTable.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-page-table", - el: { - type: "bi.sequence_table" - }, - pager: { - horizontal: { - pages: false, //总页数 - curr: 1, //初始化当前页, pages为数字时可用 - - hasPrev: BI.emptyFn, - hasNext: BI.emptyFn, - firstPage: 1, - lastPage: BI.emptyFn - }, - vertical: { - pages: false, //总页数 - curr: 1, //初始化当前页, pages为数字时可用 - - hasPrev: BI.emptyFn, - hasNext: BI.emptyFn, - firstPage: 1, - lastPage: BI.emptyFn - } - }, +BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, { - itemsCreator: BI.emptyFn, + _defaultConfig: function () { + return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-preview-table-header-cell", + text: "" + }); + }, - isNeedFreeze: false,//是否需要冻结单元格 - freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + _init: function () { + BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; - isNeedMerge: false,//是否需要合并单元格 - mergeCols: [], //合并的单元格列号 - mergeRule: BI.emptyFn, + BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "normal", + height: this.options.height, + text: this.options.text, + value: this.options.value + }) + } +}); +BI.shortcut('bi.preview_table_header_cell', BI.PreviewTableHeaderCell);/** + * 预览表 + * + * Created by GUY on 2015/12/25. + * @class BI.PreviewTable + * @extends BI.Widget + */ +BI.PreviewTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-preview-table", + isNeedFreeze: false, + freezeCols: [], + rowSize: null, columnSize: [], - minColumnSize: [], - maxColumnSize: [], - headerRowSize: 25, - rowSize: 25, - - regionColumnSize: [], - - headerCellStyleGetter: BI.emptyFn, - summaryCellStyleGetter: BI.emptyFn, - sequenceCellStyleGetter: BI.emptyFn, - + headerRowSize: 30, header: [], - items: [], //二维数组 - - //交叉表头 - crossHeader: [], - crossItems: [] + items: [] }); }, _init: function () { - BI.PageTable.superclass._init.apply(this, arguments); + BI.PreviewTable.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.hCurr = 1; - this.vCurr = 1; - this.table = BI.createWidget(o.el, { - type: "bi.sequence_table", - width: o.width, - height: o.height && o.height - 30, + this.table = BI.createWidget({ + type: "bi.table_view", + element: this, + isNeedResize: false, - isNeedResize: true, isResizeAdapt: false, isNeedFreeze: o.isNeedFreeze, freezeCols: o.freezeCols, - isNeedMerge: o.isNeedMerge, - mergeCols: o.mergeCols, - mergeRule: o.mergeRule, - + rowSize: o.rowSize, columnSize: o.columnSize, - minColumnSize: o.minColumnSize, - maxColumnSize: o.maxColumnSize, headerRowSize: o.headerRowSize, - rowSize: o.rowSize, - regionColumnSize: o.regionColumnSize, - - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter, - - header: o.header, - items: o.items, - //交叉表头 - crossHeader: o.crossHeader, - crossItems: o.crossItems - }); - - this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { - self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { - o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { - o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + header: BI.map(o.header, function (i, items) { + return BI.map(items, function (j, item) { + return BI.extend({ + type: "bi.preview_table_header_cell" + }, item); + }); + }), + items: BI.map(o.items, function (i, items) { + return BI.map(items, function (j, item) { + return BI.extend({ + type: "bi.preview_table_cell" + }, item); + }); + }) }); - - this.pager = BI.createWidget(o.pager, { - type: "bi.direction_pager", - height: 30 + this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () { + self._adjustColumns(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments); }); - this.pager.on(BI.Pager.EVENT_CHANGE, function () { - var vpage = this.getVPage && this.getVPage(); - if (BI.isNull(vpage)) { - vpage = this.getCurrentPage(); - } - var hpage = this.getHPage && this.getHPage(); - o.itemsCreator({ - vpage: vpage, - hpage: hpage - }, function (items, header, crossItems, crossHeader) { - self.table.setVPage ? self.table.setVPage(vpage) : self.table.setValue(vpage); - self.table.setHPage && self.table.setHPage(hpage); - self.populate.apply(self, arguments); - }); + this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () { + self._adjustColumns(); }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.table, - left: 0, - top: 0 - }, { - el: this.pager, - left: 0, - right: 0, - bottom: 0 - }] - }) - }, - - setHPage: function (v) { - this.hCurr = v; - this.pager.setHPage && this.pager.setHPage(v); - this.table.setHPage && this.table.setHPage(v); - }, - - setVPage: function (v) { - this.vCurr = v; - this.pager.setVPage && this.pager.setVPage(v); - this.table.setVPage && this.table.setVPage(v); - }, - - getHPage: function () { - var hpage = this.pager.getHPage && this.pager.getHPage(); - if (BI.isNotNull(hpage)) { - return hpage; - } - hpage = this.pager.getCurrentPage && this.pager.getCurrentPage(); - if (BI.isNotNull(hpage)) { - return hpage; - } - return this.hpage; }, - getVPage: function () { - var vpage = this.pager.getVPage && this.pager.getVPage(); - if (BI.isNotNull(vpage)) { - return vpage; - } - vpage = this.pager.getCurrentPage && this.pager.getCurrentPage(); - if (BI.isNotNull(vpage)) { - return vpage; - } - return this.vpage; + //是否有自适应调节的列,即列宽为"" + _hasAdaptCol: function (columnSize) { + return BI.any(columnSize, function (i, size) { + return size === ""; + }) }, - setWidth: function (width) { - BI.PageTable.superclass.setWidth.apply(this, arguments); - this.table.setWidth(width); + _isPercentage: function (columnSize) { + return columnSize[0] <= 1; }, - setHeight: function (height) { - BI.PageTable.superclass.setHeight.apply(this, arguments); - var showPager = false; - if (this.pager.alwaysShowPager) { - showPager = true; - } else if (this.pager.hasHNext && this.pager.hasHNext()) { - showPager = true; - } else if (this.pager.hasHPrev && this.pager.hasHPrev()) { - showPager = true; - } else if (this.pager.hasVNext && this.pager.hasVNext()) { - showPager = true; - } else if (this.pager.hasVPrev && this.pager.hasVPrev()) { - showPager = true; - } else if (this.pager.hasNext && this.pager.hasNext()) { - showPager = true; - } else if (this.pager.hasPrev && this.pager.hasPrev()) { - showPager = true; + _adjustColumns: function () { + var self = this, o = this.options; + if (o.isNeedFreeze === true) { + //如果存在百分比的情况 + if (this._isPercentage(o.columnSize)) { + if (this._hasAdaptCol(o.columnSize)) { + var findCols = [], remain = 0; + BI.each(o.columnSize, function (i, size) { + if (size === "") { + findCols.push(i); + } else { + remain += size; + } + }); + remain = 1 - remain; + var average = remain / findCols.length; + BI.each(findCols, function (i, col) { + o.columnSize[col] = average; + }); + } + var isRight = BI.first(o.freezeCols) !== 0; + var freezeSize = [], notFreezeSize = []; + BI.each(o.columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + freezeSize.push(size); + } else { + notFreezeSize.push(size); + } + }); + var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize); + BI.each(freezeSize, function (i, size) { + freezeSize[i] = size / sumFreezeSize; + }); + BI.each(notFreezeSize, function (i, size) { + notFreezeSize[i] = size / sumNotFreezeSize; + }); + this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]); + this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize))); + } + } else { + //如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100% + if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) { + this.table.setRegionColumnSize(["100%"]); + } } - this.table.setHeight(height - (showPager ? 30 : 0)); }, setColumnSize: function (columnSize) { - this.options.columnSize = columnSize; - this.table.setColumnSize(columnSize); + return this.table.setColumnSize(columnSize); }, getColumnSize: function () { return this.table.getColumnSize(); }, - setRegionColumnSize: function (columnSize) { - this.options.columnSize = columnSize; - this.table.setRegionColumnSize(columnSize); - }, - - getRegionColumnSize: function () { - return this.table.getRegionColumnSize(); - }, - - getVerticalScroll: function () { - return this.table.getVerticalScroll(); + getCalculateColumnSize: function () { + return this.table.getCalculateColumnSize(); }, - setLeftHorizontalScroll: function (scrollLeft) { - this.table.setLeftHorizontalScroll(scrollLeft); + setHeaderColumnSize: function (columnSize) { + return this.table.setHeaderColumnSize(columnSize); }, - setRightHorizontalScroll: function (scrollLeft) { - this.table.setRightHorizontalScroll(scrollLeft); + setRegionColumnSize: function (columnSize) { + return this.table.setRegionColumnSize(columnSize); }, - setVerticalScroll: function (scrollTop) { - this.table.setVerticalScroll(scrollTop); + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); }, - restore: function () { - this.table.restore(); + getCalculateRegionColumnSize: function () { + return this.table.getCalculateRegionColumnSize(); }, - attr: function () { - BI.PageTable.superclass.attr.apply(this, arguments); - this.table.attr.apply(this.table, arguments); + getCalculateRegionRowSize: function () { + return this.table.getCalculateRegionRowSize(); }, - populate: function () { - this.pager.populate(); - this.table.populate.apply(this.table, arguments); + getClientRegionColumnSize: function () { + return this.table.getClientRegionColumnSize(); }, - destroy: function () { - this.table.destroy(); - this.pager && this.pager.destroy(); - BI.PageTable.superclass.destroy.apply(this, arguments); - } -}); -BI.shortcut('bi.page_table', BI.PageTable);/** - * 路径选择 - * - * Created by GUY on 2015/12/4. - * @class BI.PathChooser - * @extends BI.Widget - */ -BI.PathChooser = BI.inherit(BI.Widget, { - - _const: { - lineColor: "#d4dadd", - selectLineColor: "#3f8ce8" + getScrollRegionColumnSize: function () { + return this.table.getScrollRegionColumnSize() }, - _defaultConfig: function () { - return BI.extend(BI.PathChooser.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-path-chooser", - items: [] - }) + getScrollRegionRowSize: function () { + return this.table.getScrollRegionRowSize() }, - _init: function () { - BI.PathChooser.superclass._init.apply(this, arguments); - this.populate(this.options.items); + hasVerticalScroll: function () { + return this.table.hasVerticalScroll(); }, - _createRegions: function (regions) { - var self = this; - this.regions = BI.createWidgets(BI.map(regions, function (i, region) { - return { - type: "bi.path_region", - title: self.texts[region] || region - } - })); - this.regionMap = {}; - BI.each(regions, function (i, region) { - self.regionMap[region] = i; - }); - this.container = BI.createWidget({ - type: "bi.horizontal", - verticalAlign: "top", - scrollx: false, - scrolly: false, - hgap: 10, - items: this.regions - }); - BI.createWidget({ - type: "bi.vertical_adapt", - element: this, - scrollable: true, - hgap: 10, - items: [this.container] - }); + setVerticalScroll: function (scrollTop) { + return this.table.setVerticalScroll(scrollTop); }, - getRegionIndexById: function (id) { - var node = this.store[id]; - var regionType = node.get("region"); - return this.regionMap[regionType]; + setLeftHorizontalScroll: function (scrollLeft) { + return this.table.setLeftHorizontalScroll(scrollLeft) }, - _drawPath: function (start, offset, index) { - var self = this; - var starts = []; - if (BI.contains(this.start, start)) { - starts = this.start; - } else { - starts = [start]; - } - - BI.each(starts, function (i, s) { - BI.each(self.radios[s], function (i, rad) { - rad.setSelected(false); - }); - BI.each(self.lines[s], function (i, line) { - line.attr("stroke", self._const.lineColor); - }); - BI.each(self.regionIndexes[s], function (i, idx) { - self.regions[idx].reset(); - }); - }); - - BI.each(this.routes[start][index], function (i, id) { - var regionIndex = self.getRegionIndexById(id); - self.regions[regionIndex].setSelect(offset + index, id); - }); - var current = BI.last(this.routes[start][index]); - - while (current && this.routes[current] && this.routes[current].length === 1) { - BI.each(this.routes[current][0], function (i, id) { - var regionIndex = self.getRegionIndexById(id); - self.regions[regionIndex].setSelect(0, id); - }); - this.lines[current][0].attr("stroke", self._const.selectLineColor).toFront(); - current = BI.last(this.routes[current][0]); - } - this.lines[start][index].attr("stroke", self._const.selectLineColor).toFront(); - this.radios[start] && this.radios[start][index] && this.radios[start][index].setSelected(true); + setRightHorizontalScroll: function (scrollLeft) { + return this.table.setRightHorizontalScroll(scrollLeft); }, - _drawRadio: function (start, offset, index, x, y) { - var self = this; - var radio = BI.createWidget({ - type: "bi.radio", - cls: "path-chooser-radio", - selected: offset + index === 0, - start: start, - index: index - }); - radio.on(BI.Radio.EVENT_CHANGE, function () { - self._drawPath(start, offset, index); - self.fireEvent(BI.PathChooser.EVENT_CHANGE, start, index); - }); - if (!this.radios[start]) { - this.radios[start] = []; - } - this.radios[start].push(radio); - BI.createWidget({ - type: "bi.absolute", - element: this.container, - items: [{ - el: radio, - left: x - 6.5, - top: y - 6.5 - }] - }) + getVerticalScroll: function () { + return this.table.getVerticalScroll(); }, - _drawLine: function (start, lines) { - var self = this; - if (!this.lines[start]) { - this.lines[start] = []; - } - if (!this.pathes[start]) { - this.pathes[start] = []; - } - var startRegionIndex = this.getRegionIndexById(start); - //start所在的位置,然后接着往下画其他的路径 - var offset = this.regions[startRegionIndex].getIndexByValue(start); - BI.each(lines, function (i, line) { - self.pathes[start][i] = []; - var idx = i + offset; - var path = ""; - var stop = 47.5 + 29 * idx; - var sleft = 50 + 100 * startRegionIndex; - var radioStartX = sleft, radioStartY = stop; - var etop = stop; - var endRegionIndex = self.getRegionIndexById(BI.last(line)); - var endOffset = self.regions[endRegionIndex].getIndexByValue(BI.last(line)); - var eleft = 50 + 100 * endRegionIndex; - if (BI.contains(self.start, start)) { - radioStartX = sleft - 50; - path += "M" + (sleft - 50) + "," + stop; - self.pathes[start][i].push({ - x: sleft - 50, - y: stop - }) - } else if (idx === 0) { - radioStartX = sleft + 50; - path += "M" + sleft + "," + stop; - self.pathes[start][i].push({ - x: sleft, - y: stop - }) - } else { - radioStartX = sleft + 50; - path += "M" + sleft + "," + 47.5 + "L" + (sleft + 50) + "," + 47.5 + "L" + (sleft + 50) + "," + stop; - self.pathes[start][i].push({ - x: sleft, - y: 47.5 - }); - self.pathes[start][i].push({ - x: sleft + 50, - y: 47.5 - }); - self.pathes[start][i].push({ - x: sleft + 50, - y: stop - }); - } - if (idx > 0) { - var endY = endOffset * 29 + 47.5; - path += "L" + (eleft - 50) + "," + etop + "L" + (eleft - 50) + "," + endY + "L" + eleft + "," + endY; - self.pathes[start][i].push({ - x: eleft - 50, - y: etop - }); - self.pathes[start][i].push({ - x: eleft - 50, - y: endY - }); - self.pathes[start][i].push({ - x: eleft, - y: endY - }); - } else { - path += "L" + eleft + "," + etop; - self.pathes[start][i].push({ - x: eleft, - y: etop - }); - } + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, - var graph = self.svg.path(path) - .attr({ - stroke: idx === 0 ? self._const.selectLineColor : self._const.lineColor, - 'stroke-dasharray': '-' - }); - self.lines[start].push(graph); - if (lines.length > 1) { - self.lines[start][0].toFront(); + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + getColumns: function () { + return this.table.getColumns(); + }, + + populate: function (items, header) { + this.table.populate(items, header); + } +}); +BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE"; +BI.shortcut('bi.preview_table', BI.PreviewTable);/** + * 季度下拉框 + * + * 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" + }); + + 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(); } - //第一个元素无论有多少个都要显示radio - if (BI.contains(self.start, start)) { - self.lines[self.regions[0].getValueByIndex(0)][0].toFront(); + }); + this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () { + if (self.combo.isViewVisible()) { + return; } - if (lines.length > 1 || BI.contains(self.start, start)) { - self._drawRadio(start, offset, i, radioStartX, radioStartY); + 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 }); - }, - _drawLines: function (routes) { - var self = this; - this.lines = {}; - this.pathes = {}; - this.radios = {}; - this.regionIndexes = {}; - BI.each(routes, function (k, route) { - if (!self.regionIndexes[k]) { - self.regionIndexes[k] = []; + 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", + element: this, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + minWidth: 85, + el: this.popup } - BI.each(route, function (i, rs) { - BI.each(rs, function (j, id) { - var regionIndex = self.getRegionIndexById(id); - if (!BI.contains(self.regionIndexes[k], regionIndex)) { - self.regionIndexes[k].push(regionIndex); - } - }); - }) }); - BI.each(routes, function (k, route) { - self._drawLine(k, route); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW); }); }, - _pushNodes: function (nodes) { - var self = this; - var indexes = []; - for (var i = 0; i < nodes.length; i++) { - var id = nodes[i]; - var index = self.getRegionIndexById(id); - indexes.push(index); - var region = self.regions[index]; - if (i === nodes.length - 1) { - if (!region.hasItem(id)) { - region.addItem(id, self.texts[id]); - } - break; - } - if (i > 0 || BI.contains(self.start, id)) { - region.addItem(id, self.texts[id]); - } - } - for (var i = BI.first(indexes); i < BI.last(indexes); i++) { - if (!BI.contains(indexes, i)) { - self.regions[i].addItem(""); - } - } + setValue: function (v) { + this.trigger.setValue(v); + this.popup.setValue(v); }, - _createNodes: function () { + getValue: function () { + 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);/** + * 季度展示面板 + * + * 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; - this.store = {}; - this.texts = {}; - this.start = []; - this.end = []; - BI.each(o.items, function (i, item) { - self.start.push(BI.first(item).value); - self.end.push(BI.last(item).value); + + var items = [{ + text: Date._QN[01], + value: 1 + }, { + text: Date._QN[2], + value: 2 + }, { + text: Date._QN[3], + value: 3 + }, { + text: 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.start = BI.uniq(this.start); - this.end = BI.uniq(this.end); - var regions = []; - var tree = new BI.Tree(); - var branches = {}, max = 0; - BI.each(o.items, function (i, items) { - BI.each(items, function (j, item) { - if (!BI.has(branches, item.value)) { - branches[item.value] = 0; - } - branches[item.value]++; - max = Math.max(max, branches[item.value]); - var prev = {}; - if (j > 0) { - prev = items[j - 1]; - } - var parent = self.store[prev.value || ""]; - var node = self.store[item.value] || new BI.Node(item.value); - node.set(item); - self.store[item.value] = node; - self.texts[item.value] = item.text; - self.texts[item.region] = item.regionText; - parent = BI.isNull(parent) ? tree.getRoot() : parent; - if (parent.getChildIndex(item.value) === -1) { - tree.addNode(parent, node); - } - }) + + this.quarter = BI.createWidget({ + type: "bi.button_group", + element: this, + behaviors: o.behaviors, + items: BI.createItems(items, {}), + layouts: [{ + type: "bi.vertical" + }] }); - //算出区域列表 - tree.traverse(function (node) { - BI.each(node.getChildren(), function (i, child) { - if (BI.contains(regions, child.get("region"))) { - var index1 = BI.indexOf(regions, node.get("region")); - var index2 = BI.indexOf(regions, child.get("region")); - //交换区域 - if (index1 > index2) { - var t = regions[index2]; - for (var j = index2; j < index1; j++) { - regions[j] = regions[j + 1]; - } - regions[index1] = t; - } - } else { - regions.push(child.get("region")); - } - }); + 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);/** + * 季度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, + errorText: BI.i18nText("BI-Quarter_Trigger_Error_Text") + }, + + _defaultConfig: function () { + return BI.extend(BI.QuarterTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-quarter-trigger bi-border", + height: 24 }); - this._createRegions(regions); - - //算出节点 - BI.each(branches, function (k, branch) { - if (branch < max) { - delete branches[k]; - } + }, + _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: c.errorText }); - - //过滤节点 - var nodes = []; - var n = tree.getRoot(); - while (n && n.getChildrenLength() === 1) { - if (BI.has(branches, n.getChildren()[0].id)) { - delete branches[n.getChildren()[0].id]; - n = n.getChildren()[0]; - } else { - n = null; - } - } - tree.traverse(function (node) { - if (BI.has(branches, node.id)) { - nodes.push(node.id); - delete branches[node.id]; + 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); }); - - //填充节点 - var routes = {}; - var s, e; - for (var i = 0, len = nodes.length; i < len + 1; i++) { - if (len === 0) { - s = []; - BI.each(this.start, function (i, id) { - s.push(tree.search(id)); - }); - e = []; - BI.each(this.end, function (i, id) { - e.push(tree.search(id)); - }); - } else if (i === len) { - s = e; - e = []; - BI.each(this.end, function (i, id) { - e.push(tree.search(id)); - }); - } else if (i === 0) { - s = []; - BI.each(this.start, function (i, id) { - s.push(tree.search(id)); - }); - e = [tree.search(nodes[i])]; - } else { - s = [tree.search(e[0] || tree.getRoot(), nodes[i - 1])]; - e = [tree.search(s[0], nodes[i])]; + this.editor.on(BI.SignEditor.EVENT_SPACE, function () { + if (self.editor.isValid()) { + self.editor.blur(); } - BI.each(s, function (i, n) { - tree._recursion(n, [n.id], function (node, route) { - if (BI.contains(e, node)) { - if (!routes[n.id]) { - routes[n.id] = []; - } - routes[n.id].push(route); - self._pushNodes(route); - if (e.length <= 1) { - return true; - } - } - }) - }); - } - this.routes = routes; - this._drawLines(routes); - }, - - _unselectAllPath: function () { - var self = this; - BI.each(this.radios, function (idx, rad) { - BI.each(rad, function (i, r) { - r.setSelected(false); - }); }); - BI.each(this.lines, function (idx, line) { - BI.each(line, function (i, li) { - li.attr("stroke", self._const.lineColor); - }); + this.editor.on(BI.SignEditor.EVENT_START, function () { + self.fireEvent(BI.QuarterTrigger.EVENT_START); }); - BI.each(this.regions, function (idx, region) { - region.reset(); + this.editor.on(BI.SignEditor.EVENT_STOP, function () { + self.fireEvent(BI.QuarterTrigger.EVENT_STOP); }); - }, - populate: function (items) { - this.options.items = items || []; - var self = this; - this.empty(); - if (this.options.items.length <= 0) { - return; - } - this.svg = BI.createWidget({ - type: "bi.svg" - }); - this._createNodes(); BI.createWidget({ - type: "bi.absolute", - element: this.container, - items: [{ - el: this.svg, - top: 0, - left: 0, - right: 0, - bottom: 0 - }] + 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 + } + ] }); }, setValue: function (v) { - this._unselectAllPath(); - var nodes = BI.keys(this.routes), self = this; - var result = [], array = []; - BI.each(v, function (i, val) { - if (BI.contains(nodes, val)) { - if (array.length > 0) { - array.push(val); - result.push(array); - array = []; - } - } - array.push(val); + 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);/** + * 关联视图字段Item + * + * Created by GUY on 2015/12/23. + * @class BI.RelationViewItem + * @extends BI.Widget + */ +BI.RelationViewItem = BI.inherit(BI.BasicButton, { + + _defaultConfig: function () { + return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view-item bi-list-item-active", + height: 25, + hoverIn: BI.emptyFn, + hoverOut: BI.emptyFn }); - if (array.length > 0) { - result.push(array); - } - //画这n条路径 - BI.each(result, function (idx, path) { - var start = path[0]; - var index = BI.findIndex(self.routes[start], function (idx, p) { - if (BI.isEqual(path, p)) { - return true; - } + }, + + _init: function () { + BI.RelationViewItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.element.hover(o.hoverIn, o.hoverOut); + var items = []; + if (o.isPrimary) { + items.push({ + type: "bi.icon", + width: 16, + height: 16, + title: BI.i18nText("BI-Primary_Key") }); - if (index >= 0) { - var startRegionIndex = self.getRegionIndexById(start); - var offset = self.regions[startRegionIndex].getIndexByValue(start); - self._drawPath(start, offset, index); - } + } + items.push({ + type: "bi.label", + text: o.text, + value: o.value, + height: o.height, + textAlign: "left", + width: o.isPrimary ? 70 : 90, + lgap: o.isPrimary ? 0 : 10 + }); + BI.createWidget({ + type: "bi.vertical_adapt", + element: this, + items: items, + cls: "primary-key-font", + lgap: 5 }); }, - getValue: function () { - var path = []; - BI.each(this.regions, function (i, region) { - var val = region.getValue(); - if (BI.isKey(val)) { - path.push(val); - } - }); - return path; + enableHover: function (opt) { + BI.RelationViewRegion.superclass.enableHover.apply(this, [{ + container: "body" + }]); + }, + + setSelected: function (b) { + this.element[b ? "addClass" : "removeClass"]("active"); } }); -BI.PathChooser.EVENT_CHANGE = "PathChooser.EVENT_CHANGE"; -BI.shortcut("bi.path_chooser", BI.PathChooser);/** - * 路径选择区域 +BI.shortcut('bi.relation_view_item', BI.RelationViewItem);/** + * 关联视图 * - * Created by GUY on 2015/12/4. - * @class BI.PathRegion + * Created by GUY on 2015/12/22. + * @class BI.RelationView * @extends BI.Widget */ -BI.PathRegion = BI.inherit(BI.Widget, { +BI.RelationView = BI.inherit(BI.Widget, { + + _const: { + lineColor: "#c4c6c6", + selectLineColor: "#009de3" + }, _defaultConfig: function () { - return BI.extend(BI.PathRegion.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-path-region bi-background", - width: 80, - title: "" - }) + return BI.extend(BI.RelationView.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view", + items: [] + }); }, _init: function () { - BI.PathRegion.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.zIndex = 100; - var title = BI.createWidget({ - type: "bi.label", - text: o.title, - title: o.title, - height: 30 + BI.RelationView.superclass._init.apply(this, arguments); + this.populate(this.options.items); + }, + + _calculateWidths: function () { + var widths = []; + BI.each(this.views, function (i, items) { + BI.each(items, function (j, obj) { + if (!widths[j]) { + widths[j] = BI.MIN; + } + widths[j] = Math.max(widths[j], obj.getWidth()); + }) }); - title.element.css("zIndex", this.zIndex--); - this.items = []; - this.vertical = BI.createWidget({ - type: "bi.vertical", - element: this, - bgap: 5, - hgap: 10, - items: [title] - }) + return widths; }, - hasItem: function (val) { - return BI.any(this.items, function (i, item) { - return val === item.getValue(); + _calculateHeights: function () { + var heights = BI.makeArray(BI.size(this.views), BI.MIN); + BI.each(this.views, function (i, items) { + BI.each(items, function (j, obj) { + heights[i] = Math.max(heights[i], obj.getHeight()); + }) }); + return heights; }, - addItem: function (value, text) { - if (BI.isKey(value)) { - var label = BI.createWidget({ - type: "bi.label", - cls: "path-region-label bi-card bi-border bi-list-item-select", - text: text, - value: value, - title: text || value, - height: 24 + _hoverIn: function (target) { + var self = this, c = this._const; + BI.each(this.relations, function (start, rs) { + BI.each(rs, function (end, relation) { + if (relation[0].primary.value === target || relation[0].foreign.value === target) { + self.lines[start][end].attr("stroke", c.selectLineColor).toFront(); + self.storeViews[start].setValue(relation[0].primary.value); + self.storeViews[end].setValue(relation[0].foreign.value); + } }); - } else { - var label = BI.createWidget({ - type: "bi.layout", - height: 24 + }); + }, + + _hoverOut: function (target) { + var self = this, c = this._const; + BI.each(this.relations, function (start, rs) { + BI.each(rs, function (end, relation) { + if (relation[0].primary.value === target || relation[0].foreign.value === target) { + self.lines[start][end].attr("stroke", c.lineColor); + self.storeViews[start].setValue([]); + self.storeViews[end].setValue([]); + } }); + }); + }, + + previewRelationTables: function(relationTables, show) { + if (!show) { + BI.each(this.storeViews, function (i, view) { + view.toggleRegion(true); + view.setPreviewSelected(false); + }); + BI.each(this.lines, function (i, lines) { + BI.each(lines, function (j, line) { + line.show(); + }); + }); + return; } - label.element.css("zIndex", this.zIndex--); - this.items.push(label); - this.vertical.addItem(label); - if (this.items.length === 1) { - this.setSelect(0, value); - } + BI.each(this.storeViews, function (id, view) { + if (!relationTables.contains(id)) { + view.toggleRegion(false); + } else { + view.setPreviewSelected(true); + } + }); + BI.each(this.lines, function (id, lines) { + BI.each(lines, function (cId, line) { + if (!relationTables.contains(id) || !relationTables.contains(cId)) { + line.hide(); + } + }); + }); }, - reset: function () { - BI.each(this.items, function (i, item) { - item.element.removeClass("active"); + populate: function (items) { + var self = this, o = this.options, c = this._const; + o.items = items || []; + this.empty(); + this.svg = BI.createWidget({ + type: "bi.svg" + }); + + //算出所有的区域和关联 + var regions = this.regions = {}, relations = this.relations = {}; + BI.each(items, function (i, item) { + var pr = item.primary.region, fr = item.foreign && item.foreign.region; + if (pr && !relations[pr]) { + relations[pr] = {}; + } + if (pr && fr && !relations[pr][fr]) { + relations[pr][fr] = []; + } + if (pr && !regions[pr]) { + regions[pr] = []; + } + if (fr && !regions[fr]) { + regions[fr] = []; + } + if (pr && !BI.deepContains(regions[pr], item.primary)) { + regions[pr].push(item.primary); + } + if (fr && !BI.deepContains(regions[fr], item.foreign)) { + regions[fr].push(item.foreign); + } + pr && fr && relations[pr][fr].push(item); + }); + //求拓扑 + var topology = []; + var rs = BI.clone(regions), store = {}; + while (!BI.isEmpty(rs)) { + var clone = BI.clone(rs); + BI.each(o.items, function (i, item) { + if (!store[item.primary.region]) { + delete clone[item.foreign && item.foreign.region]; + } + }); + topology.push(BI.keys(clone)); + BI.extend(store, clone); + BI.each(clone, function (k, v) { + delete rs[k]; + }); + } + //构建视图 + var views = this.views = {}, storeViews = this.storeViews = {}, indexes = this.indexes = {}; + var verticals = []; + BI.each(topology, function (i, items) { + if (!views[i]) { + views[i] = {}; + } + var horizontal = []; + BI.each(items, function (j, region) { + var items = regions[region]; + views[i][j] = storeViews[region] = BI.createWidget({ + type: "bi.relation_view_region_container", + value: region, + header: items[0].regionTitle, + text: items.length > 0 ? items[0].regionText : "", + handler: items.length > 0 ? items[0].regionHandler : BI.emptyFn, + items: items, + belongPackage: items.length > 0 ? items[0].belongPackage : true + }); + if (BI.isNotNull(items[0]) && BI.isNotNull(items[0].keyword)) { + views[i][j].doRedMark(items[0].keyword); + } + views[i][j].on(BI.RelationViewRegionContainer.EVENT_HOVER_IN, function (v) { + self._hoverIn(v); + }); + views[i][j].on(BI.RelationViewRegionContainer.EVENT_HOVER_OUT, function (v) { + self._hoverOut(v); + }); + views[i][j].on(BI.RelationViewRegionContainer.EVENT_PREVIEW, function (v) { + self.fireEvent(BI.RelationView.EVENT_PREVIEW, region, v); + }); + indexes[region] = {i: i, j: j}; + horizontal.push(views[i][j]); + }); + verticals.push({ + type: "bi.horizontal", + items: horizontal + }) }); - }, - - setSelect: function (index, value) { - this.reset(); - if (this.items.length <= 0) { - return; - } - if (this.items.length === 1) { - this.items[0].element.addClass("active"); - return; - } - if (this.items[index].attr("value") === value) { - this.items[index].element.addClass("active"); - } - }, - setValue: function (value) { - this.setSelect(this.getIndexByValue(value), value); - }, + //求每一行的高度 + var heights = this._calculateHeights(); - getValueByIndex: function (idx) { - return this.items[idx].attr("value"); - }, + //求每一列的宽度 + var widths = this._calculateWidths(); - getIndexByValue: function (value) { - return BI.findIndex(this.items, function (i, item) { - return item.attr("value") === value; + //求相对宽度和高度 + var offsetWidths = [0], offsetHeights = [0]; + BI.each(heights, function (i, h) { + if (i === 0) { + return; + } + offsetHeights[i] = offsetHeights[i - 1] + heights[i - 1]; }); - }, - - getValue: function () { - var res; - BI.any(this.items, function (i, item) { - if (item.element.hasClass("active")) { - res = item.getValue(); - return true; + BI.each(widths, function (i, w) { + if (i === 0) { + return; } + offsetWidths[i] = offsetWidths[i - 1] + widths[i - 1]; }); - return res; - } -}); -BI.PathRegion.EVENT_CHANGE = "PathRegion.EVENT_CHANGE"; -BI.shortcut("bi.path_region", BI.PathRegion);/** - * 预览表列 - * - * Created by GUY on 2015/12/25. - * @class BI.PreviewTableCell - * @extends BI.Widget - */ -BI.PreviewTableCell = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-preview-table-cell", - text: "" + //画线 + var lines = this.lines = {};//缓存所有的线 + BI.each(relations, function (start, rs) { + BI.each(rs, function (end, relation) { + var startIndex = indexes[start], endIndex = indexes[end]; + var top = 0, right = 1, bottom = 2, left = 3; + var startDirection = bottom, endDirection = top; + // if (startIndex.j > endIndex.j) { + // startDirection = left; + // endDirection = right; + // } else if (startIndex.j < endIndex.j) { + // startDirection = right; + // endDirection = left; + // } else if (startIndex.i < endIndex.i) { + // startDirection = bottom; + // endDirection = top; + // } else if (startIndex.i > endIndex.i) { + // startDirection = top; + // endDirection = bottom; + // } + var draw = function (i, j, direction, isForeign) { + var x = offsetWidths[j] + (widths[j] - views[i][j].getWidth()) / 2; + var y = offsetHeights[i] + (heights[i] - views[i][j].getHeight()) / 2; + var path = "", position; + switch (direction) { + case top: + position = isForeign ? views[i][j].getTopRightPosition() : views[i][j].getTopLeftPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + x + "," + (y - 10); + y -= 10; + break; + case right: + position = views[i][j].getRightPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + (x + 10) + "," + y; + x += 10; + break; + case bottom: + position = views[i][j].getBottomPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + x + "," + (y + 10); + y += 10; + break; + case left: + position = views[i][j].getLeftPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + (x - 10) + "," + y; + x -= 10; + break; + } + return {x: x, y: y, path: path}; + }; + var path = ""; + var si = draw(startIndex.i, startIndex.j, startDirection); + var ei = draw(endIndex.i, endIndex.j, endDirection, true); + path += si.path + ei.path; + if (!lines[start]) { + lines[start] = {}; + } + path += "M" + si.x + "," + si.y + "L" + ei.x + "," + ei.y; + var line = lines[start][end] = self.svg.path(path) + .attr({"stroke": c.lineColor, "stroke-width": "2"}) + .hover(function () { + line.attr("stroke", c.selectLineColor).toFront(); + storeViews[start].setValue(relation[0].primary.value); + storeViews[end].setValue(relation[0].foreign.value); + }, function () { + line.attr("stroke", c.lineColor); + storeViews[start].setValue([]); + storeViews[end].setValue([]); + }); + }); }); - }, - - _init: function () { - BI.PreviewTableCell.superclass._init.apply(this, arguments); - var self = this, o = this.options; - + var container = BI.createWidget(); BI.createWidget({ - type: "bi.label", - element: this, - textAlign: "left", - whiteSpace: "normal", - height: this.options.height, - text: this.options.text, - value: this.options.value - }) - } -}); -BI.shortcut('bi.preview_table_cell', BI.PreviewTableCell);/** - * 预览表 - * - * Created by GUY on 2015/12/25. - * @class BI.PreviewTableHeaderCell - * @extends BI.Widget - */ -BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, { - - _defaultConfig: function () { - return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-preview-table-header-cell", - text: "" + type: "bi.vertical", + element: container, + items: verticals }); - }, - - _init: function () { - BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments); - var self = this, o = this.options; - BI.createWidget({ - type: "bi.label", - element: this, - textAlign: "left", - whiteSpace: "normal", - height: this.options.height, - text: this.options.text, - value: this.options.value - }) - } -}); -BI.shortcut('bi.preview_table_header_cell', BI.PreviewTableHeaderCell);/** - * 预览表 - * - * Created by GUY on 2015/12/25. - * @class BI.PreviewTable - * @extends BI.Widget - */ -BI.PreviewTable = BI.inherit(BI.Widget, { - - _defaultConfig: function () { - return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-preview-table", - isNeedFreeze: false, - freezeCols: [], - rowSize: null, - columnSize: [], - headerRowSize: 30, - header: [], - items: [] + type: "bi.absolute", + element: container, + items: [{ + el: this.svg, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] }); - }, - - _init: function () { - BI.PreviewTable.superclass._init.apply(this, arguments); - var self = this, o = this.options; - - this.table = BI.createWidget({ - type: "bi.table_view", - element: this, - isNeedResize: false, - - isResizeAdapt: false, - - isNeedFreeze: o.isNeedFreeze, - freezeCols: o.freezeCols, - - rowSize: o.rowSize, - columnSize: o.columnSize, - headerRowSize: o.headerRowSize, - header: BI.map(o.header, function (i, items) { - return BI.map(items, function (j, item) { - return BI.extend({ - type: "bi.preview_table_header_cell" - }, item); - }); - }), - items: BI.map(o.items, function (i, items) { - return BI.map(items, function (j, item) { - return BI.extend({ - type: "bi.preview_table_cell" - }, item); - }); - }) - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () { - self._adjustColumns(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments); + BI.createWidget({ + type: "bi.center_adapt", + scrollable: true, + element: this, + items: [container] }); - this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () { - self._adjustColumns(); + } +}); +BI.RelationView.EVENT_CHANGE = "RelationView.EVENT_CHANGE"; +BI.RelationView.EVENT_PREVIEW = "EVENT_PREVIEW"; +BI.shortcut('bi.relation_view', BI.RelationView);/** + * Created by Young's on 2017/3/10. + */ +BI.RelationViewRegionContainer = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.RelationViewRegionContainer.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view-region-container", + width: 150 }); }, - //是否有自适应调节的列,即列宽为"" - _hasAdaptCol: function (columnSize) { - return BI.any(columnSize, function (i, size) { - return size === ""; - }) - }, - - _isPercentage: function (columnSize) { - return columnSize[0] <= 1; - }, - - _adjustColumns: function () { + _init: function () { + BI.RelationViewRegionContainer.superclass._init.apply(this, arguments); var self = this, o = this.options; - if (o.isNeedFreeze === true) { - //如果存在百分比的情况 - if (this._isPercentage(o.columnSize)) { - if (this._hasAdaptCol(o.columnSize)) { - var findCols = [], remain = 0; - BI.each(o.columnSize, function (i, size) { - if (size === "") { - findCols.push(i); - } else { - remain += size; - } - }); - remain = 1 - remain; - var average = remain / findCols.length; - BI.each(findCols, function (i, col) { - o.columnSize[col] = average; - }); - } - var isRight = BI.first(o.freezeCols) !== 0; - var freezeSize = [], notFreezeSize = []; - BI.each(o.columnSize, function (i, size) { - if (o.freezeCols.contains(i)) { - freezeSize.push(size); - } else { - notFreezeSize.push(size); - } - }); - var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize); - BI.each(freezeSize, function (i, size) { - freezeSize[i] = size / sumFreezeSize; - }); - BI.each(notFreezeSize, function (i, size) { - notFreezeSize[i] = size / sumNotFreezeSize; - }); - this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]); - this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize))); - } - } else { - //如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100% - if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) { - this.table.setRegionColumnSize(["100%"]); - } - } - }, - - setColumnSize: function (columnSize) { - return this.table.setColumnSize(columnSize); - }, - - getColumnSize: function () { - return this.table.getColumnSize(); - }, - - getCalculateColumnSize: function () { - return this.table.getCalculateColumnSize(); - }, - - setHeaderColumnSize: function (columnSize) { - return this.table.setHeaderColumnSize(columnSize); - }, - - setRegionColumnSize: function (columnSize) { - return this.table.setRegionColumnSize(columnSize); - }, - - getRegionColumnSize: function () { - return this.table.getRegionColumnSize(); - }, - - getCalculateRegionColumnSize: function () { - return this.table.getCalculateRegionColumnSize(); - }, - - getCalculateRegionRowSize: function () { - return this.table.getCalculateRegionRowSize(); - }, - - getClientRegionColumnSize: function () { - return this.table.getClientRegionColumnSize(); - }, - - getScrollRegionColumnSize: function () { - return this.table.getScrollRegionColumnSize() - }, - - getScrollRegionRowSize: function () { - return this.table.getScrollRegionRowSize() - }, - - hasVerticalScroll: function () { - return this.table.hasVerticalScroll(); + this.region = BI.createWidget({ + type: "bi.relation_view_region", + value: o.value, + header: o.header, + text: o.text, + handler: o.handler, + items: o.items, + belongPackage: o.belongPackage + }); + this.region.on(BI.RelationViewRegion.EVENT_PREVIEW, function (v) { + self.fireEvent(BI.RelationViewRegionContainer.EVENT_PREVIEW, v); + }); + this.region.on(BI.RelationViewRegion.EVENT_HOVER_IN, function (v) { + self.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_IN, v); + }); + this.region.on(BI.RelationViewRegion.EVENT_HOVER_OUT, function (v) { + self.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_OUT, v); + }); + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.region], + width: this.region.getWidth(), + height: this.region.getHeight() + }); }, - setVerticalScroll: function (scrollTop) { - return this.table.setVerticalScroll(scrollTop); + doRedMark: function () { + this.region.doRedMark.apply(this.region, arguments); }, - setLeftHorizontalScroll: function (scrollLeft) { - return this.table.setLeftHorizontalScroll(scrollLeft) + unRedMark: function () { + this.region.unRedMark.apply(this.region, arguments); }, - setRightHorizontalScroll: function (scrollLeft) { - return this.table.setRightHorizontalScroll(scrollLeft); + getWidth: function () { + return this.region.getWidth(); }, - getVerticalScroll: function () { - return this.table.getVerticalScroll(); + getHeight: function () { + return this.region.getHeight(); }, - getLeftHorizontalScroll: function () { - return this.table.getLeftHorizontalScroll(); + //获取上方开始划线的位置 + getTopLeftPosition: function () { + return this.region.getTopLeftPosition(); }, - getRightHorizontalScroll: function () { - return this.table.getRightHorizontalScroll(); + getTopRightPosition: function () { + return this.region.getTopRightPosition(); }, - getColumns: function () { - return this.table.getColumns(); + getBottomPosition: function () { + return this.region.getBottomPosition(); }, - populate: function (items, header) { - this.table.populate(items, header); - } -}); -BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE"; -BI.shortcut('bi.preview_table', BI.PreviewTable);/** - * 季度下拉框 - * - * 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 - }); + getLeftPosition: function () { + return this.region.getLeftPosition(); }, - _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" - }); - - 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 - }); - - 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", - 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); - }); + getRightPosition: function () { + return this.region.getRightPosition(); }, setValue: function (v) { - this.trigger.setValue(v); - this.popup.setValue(v); + this.region.setValue(v); + }, + + toggleRegion: function (v) { + v === true ? this.region.element.fadeIn() : this.region.element.fadeOut(); }, - getValue: function () { - return this.popup.getValue() || ""; + setPreviewSelected: function(v) { + this.region.setPreviewSelected(v); } }); - -BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; -BI.shortcut('bi.quarter_combo', BI.QuarterCombo);/** - * 季度展示面板 +BI.RelationViewRegionContainer.EVENT_HOVER_IN = "RelationViewRegion.EVENT_HOVER_IN"; +BI.RelationViewRegionContainer.EVENT_HOVER_OUT = "RelationViewRegion.EVENT_HOVER_OUT"; +BI.RelationViewRegionContainer.EVENT_PREVIEW = "RelationViewRegion.EVENT_PREVIEW"; +BI.shortcut("bi.relation_view_region_container", BI.RelationViewRegionContainer);/** + * 关联视图 * - * Created by GUY on 2015/9/2. - * @class BI.QuarterPopup - * @extends BI.Trigger + * Created by GUY on 2015/12/23. + * @class BI.RelationViewRegion + * @extends BI.BasicButton */ -BI.QuarterPopup = BI.inherit(BI.Widget, { +BI.RelationViewRegion = BI.inherit(BI.BasicButton, { _defaultConfig: function () { - return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-quarter-popup", - behaviors: {} + return BI.extend(BI.RelationViewRegion.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view-region cursor-pointer", + width: 150, + text: "", + value: "", + header: "", + items: [], + belongPackage: true }); }, _init: function () { - BI.QuarterPopup.superclass._init.apply(this, arguments); + BI.RelationViewRegion.superclass._init.apply(this, arguments); var self = this, o = this.options; - var items = [{ - text: Date._QN[01], - value: 1 - }, { - text: Date._QN[2], - value: 2 - }, { - text: Date._QN[3], - value: 3 - }, { - text: 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.preview = BI.createWidget({ + type: "bi.icon_button", + cls: "relation-table-preview-font", + width: 25, + height: 25, + stopPropagation: true + }); + this.preview.on(BI.IconButton.EVENT_CHANGE, function () { + self.fireEvent(BI.RelationViewRegion.EVENT_PREVIEW, this.isSelected()); }); - this.quarter = BI.createWidget({ + this.title = BI.createWidget({ + type: "bi.label", + height: 25, + width: 70, + text: o.text, + value: o.value, + textAlign: "left" + }); + //title放body上 + if (BI.isKey(o.header)) { + this.title.setTitle(o.header, { + container: "body" + }) + } + + this.button_group = BI.createWidget({ type: "bi.button_group", - element: this, - behaviors: o.behaviors, - items: BI.createItems(items, {}), + items: this._createItems(o.items), layouts: [{ type: "bi.vertical" }] }); - 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); - } + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [{ + type: "bi.vertical", + cls: "relation-view-region-container bi-card bi-border " + (o.belongPackage ? "" : "other-package"), + items: [{ + type: "bi.vertical_adapt", + cls: "relation-view-region-title bi-border-bottom", + items: [this.preview, this.title] + }, this.button_group] + }], + hgap: 25, + vgap: 20 }) }, - getValue: function () { - return this.quarter.getValue()[0]; + _createItems: function (items) { + var self = this; + return BI.map(items, function (i, item) { + return BI.extend(item, { + type: "bi.relation_view_item", + hoverIn: function () { + self.setValue(item.value); + self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN, item.value); + }, + hoverOut: function () { + self.setValue([]); + self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_OUT, item.value); + } + }) + }); }, - setValue: function (v) { - this.quarter.setValue([v]); - } -}); -BI.QuarterPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.quarter_popup", BI.QuarterPopup);/** - * 季度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, - errorText: BI.i18nText("BI-Quarter_Trigger_Error_Text") + doRedMark: function () { + this.title.doRedMark.apply(this.title, arguments); }, - _defaultConfig: function () { - return BI.extend(BI.QuarterTrigger.superclass._defaultConfig.apply(this, arguments), { - extraCls: "bi-quarter-trigger bi-border", - height: 24 - }); + unRedMark: function () { + this.title.unRedMark.apply(this.title, arguments); }, - _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: c.errorText - }); - 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 - } - ] - }); + getWidth: function () { + return this.options.width; }, - setValue: function (v) { - v = v || ""; - this.editor.setState(v); - this.editor.setValue(v); - this.editor.setTitle(v); + getHeight: function () { + return this.button_group.getAllButtons().length * 25 + 25 + 2 * 20 + 3; }, - 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);/** - * 关联视图字段Item - * - * Created by GUY on 2015/12/23. - * @class BI.RelationViewItem - * @extends BI.Widget - */ -BI.RelationViewItem = BI.inherit(BI.BasicButton, { + //获取上方开始划线的位置 + getTopLeftPosition: function () { + return { + x: 25 + 10, + y: 20 + } + }, + + getTopRightPosition: function () { + return { + x: this.getWidth() - 25 - 10, + y: 20 + } + }, - _defaultConfig: function () { - return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-relation-view-item bi-list-item-active", - height: 25, - hoverIn: BI.emptyFn, - hoverOut: BI.emptyFn - }); + getBottomPosition: function () { + return { + x: 25 + 10, + y: this.getHeight() - 20 + } }, - _init: function () { - BI.RelationViewItem.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.element.hover(o.hoverIn, o.hoverOut); - var items = []; - if (o.isPrimary) { - items.push({ - type: "bi.icon", - width: 16, - height: 16, - title: BI.i18nText("BI-Primary_Key") - }); + getLeftPosition: function () { + return { + x: 25, + y: 20 + 10 } - items.push({ - type: "bi.label", - text: o.text, - value: o.value, - height: o.height, - textAlign: "left", - width: o.isPrimary ? 70 : 90, - lgap: o.isPrimary ? 0 : 10 - }); - BI.createWidget({ - type: "bi.vertical_adapt", - element: this, - items: items, - cls: "primary-key-font", - lgap: 5 - }); }, - enableHover: function (opt) { - BI.RelationViewRegion.superclass.enableHover.apply(this, [{ - container: "body" - }]); + getRightPosition: function () { + return { + x: this.getWidth() - 25, + y: 20 + 10 + } }, - setSelected: function (b) { - this.element[b ? "addClass" : "removeClass"]("active"); + setValue: function (v) { + this.button_group.setValue(v); + }, + + setPreviewSelected: function(v) { + this.preview.setSelected(v); } }); -BI.shortcut('bi.relation_view_item', BI.RelationViewItem);/** - * 关联视图 +BI.RelationViewRegion.EVENT_HOVER_IN = "RelationViewRegion.EVENT_HOVER_IN"; +BI.RelationViewRegion.EVENT_HOVER_OUT = "RelationViewRegion.EVENT_HOVER_OUT"; +BI.RelationViewRegion.EVENT_PREVIEW = "RelationViewRegion.EVENT_PREVIEW"; +BI.shortcut('bi.relation_view_region', BI.RelationViewRegion);/** + * 自适应宽度的表格 * - * Created by GUY on 2015/12/22. - * @class BI.RelationView + * Created by GUY on 2016/2/3. + * @class BI.ResponisveTable * @extends BI.Widget */ -BI.RelationView = BI.inherit(BI.Widget, { +BI.ResponisveTable = BI.inherit(BI.Widget, { _const: { - lineColor: "#c4c6c6", - selectLineColor: "#009de3" + perColumnSize: 100 }, _defaultConfig: function () { - return BI.extend(BI.RelationView.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-relation-view", - items: [] + return BI.extend(BI.ResponisveTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-responsive-table", + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: function (row1, row2) { //合并规则, 默认相等时合并 + return BI.isEqual(row1, row2); + }, + + columnSize: [], + headerRowSize: 25, + footerRowSize: 25, + rowSize: 25, + + regionColumnSize: false, + + header: [], + footer: false, + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [] }); }, _init: function () { - BI.RelationView.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, + BI.ResponisveTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; - _calculateWidths: function () { - var widths = []; - BI.each(this.views, function (i, items) { - BI.each(items, function (j, obj) { - if (!widths[j]) { - widths[j] = BI.MIN; - } - widths[j] = Math.max(widths[j], obj.getWidth()); - }) - }); - return widths; - }, + this.table = BI.createWidget({ + type: "bi.table_view", + element: this, - _calculateHeights: function () { - var heights = BI.makeArray(BI.size(this.views), BI.MIN); - BI.each(this.views, function (i, items) { - BI.each(items, function (j, obj) { - heights[i] = Math.max(heights[i], obj.getHeight()); - }) - }); - return heights; - }, + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, - _hoverIn: function (target) { - var self = this, c = this._const; - BI.each(this.relations, function (start, rs) { - BI.each(rs, function (end, relation) { - if (relation[0].primary.value === target || relation[0].foreign.value === target) { - self.lines[start][end].attr("stroke", c.selectLineColor).toFront(); - self.storeViews[start].setValue(relation[0].primary.value); - self.storeViews[end].setValue(relation[0].foreign.value); - } - }); + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: o.columnSize, + headerRowSize: o.headerRowSize, + footerRowSize: o.footerRowSize, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize, + + header: o.header, + footer: o.footer, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () { + self._initRegionSize(); + self.table.resize(); + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () { + self._resizeRegion(); + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, function () { + self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE, function () { + //important:在冻结并自适应列宽的情况下要随时变更表头宽度 + if (o.isNeedResize === true && self._isAdaptiveColumn()) { + self._resizeHeader(); + } + self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); }); - }, - _hoverOut: function (target) { - var self = this, c = this._const; - BI.each(this.relations, function (start, rs) { - BI.each(rs, function (end, relation) { - if (relation[0].primary.value === target || relation[0].foreign.value === target) { - self.lines[start][end].attr("stroke", c.lineColor); - self.storeViews[start].setValue([]); - self.storeViews[end].setValue([]); - } - }); + this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, function () { + self._resizeBody(); + self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE, function () { + self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + self._resizeRegion(); + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); }); }, - previewRelationTables: function(relationTables, show) { - if (!show) { - BI.each(this.storeViews, function (i, view) { - view.toggleRegion(true); - view.setPreviewSelected(false); - }); - BI.each(this.lines, function (i, lines) { - BI.each(lines, function (j, line) { - line.show(); - }); - }); - return; - } - BI.each(this.storeViews, function (id, view) { - if (!relationTables.contains(id)) { - view.toggleRegion(false); - } else { - view.setPreviewSelected(true); - } - }); - BI.each(this.lines, function (id, lines) { - BI.each(lines, function (cId, line) { - if (!relationTables.contains(id) || !relationTables.contains(cId)) { - line.hide(); + _initRegionSize: function () { + var o = this.options; + if (o.isNeedFreeze === true) { + var regionColumnSize = this.table.getRegionColumnSize(); + var maxWidth = this.table.element.width(); + if (!regionColumnSize[0] || (regionColumnSize[0] === 'fill') || regionColumnSize[0] > maxWidth || regionColumnSize[1] > maxWidth) { + var freezeCols = o.freezeCols; + if (freezeCols.length === 0) { + this.table.setRegionColumnSize([0, "fill"]); + } else if (freezeCols.length > 0 && freezeCols.length < o.columnSize.length) { + var size = maxWidth / 3; + if (freezeCols.length > o.columnSize.length / 2) { + size = maxWidth * 2 / 3; + } + this.table.setRegionColumnSize([size, "fill"]); + } else { + this.table.setRegionColumnSize(["fill", 0]); } - }); - }); + } + } }, - populate: function (items) { - var self = this, o = this.options, c = this._const; - o.items = items || []; - this.empty(); - this.svg = BI.createWidget({ - type: "bi.svg" - }); - - //算出所有的区域和关联 - var regions = this.regions = {}, relations = this.relations = {}; - BI.each(items, function (i, item) { - var pr = item.primary.region, fr = item.foreign && item.foreign.region; - if (pr && !relations[pr]) { - relations[pr] = {}; - } - if (pr && fr && !relations[pr][fr]) { - relations[pr][fr] = []; - } - if (pr && !regions[pr]) { - regions[pr] = []; - } - if (fr && !regions[fr]) { - regions[fr] = []; - } - if (pr && !BI.deepContains(regions[pr], item.primary)) { - regions[pr].push(item.primary); - } - if (fr && !BI.deepContains(regions[fr], item.foreign)) { - regions[fr].push(item.foreign); - } - pr && fr && relations[pr][fr].push(item); - }); - //求拓扑 - var topology = []; - var rs = BI.clone(regions), store = {}; - while (!BI.isEmpty(rs)) { - var clone = BI.clone(rs); - BI.each(o.items, function (i, item) { - if (!store[item.primary.region]) { - delete clone[item.foreign && item.foreign.region]; + _getBlockSize: function () { + var o = this.options; + var columnSize = this.table.getCalculateColumnSize(); + if (o.isNeedFreeze === true) { + var columnSizeLeft = [], columnSizeRight = []; + BI.each(columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + columnSizeLeft.push(size); + } else { + columnSizeRight.push(size); } }); - topology.push(BI.keys(clone)); - BI.extend(store, clone); - BI.each(clone, function (k, v) { - delete rs[k]; - }); - } - //构建视图 - var views = this.views = {}, storeViews = this.storeViews = {}, indexes = this.indexes = {}; - var verticals = []; - BI.each(topology, function (i, items) { - if (!views[i]) { - views[i] = {}; + //因为有边框,所以加上数组长度的参数调整 + var sumLeft = BI.sum(columnSizeLeft) + columnSizeLeft.length, + sumRight = BI.sum(columnSizeRight) + columnSizeRight.length; + return { + sumLeft: sumLeft, + sumRight: sumRight, + left: columnSizeLeft, + right: columnSizeRight } - var horizontal = []; - BI.each(items, function (j, region) { - var items = regions[region]; - views[i][j] = storeViews[region] = BI.createWidget({ - type: "bi.relation_view_region_container", - value: region, - header: items[0].regionTitle, - text: items.length > 0 ? items[0].regionText : "", - handler: items.length > 0 ? items[0].regionHandler : BI.emptyFn, - items: items, - belongPackage: items.length > 0 ? items[0].belongPackage : true - }); - if (BI.isNotNull(items[0]) && BI.isNotNull(items[0].keyword)) { - views[i][j].doRedMark(items[0].keyword); - } - views[i][j].on(BI.RelationViewRegionContainer.EVENT_HOVER_IN, function (v) { - self._hoverIn(v); - }); - views[i][j].on(BI.RelationViewRegionContainer.EVENT_HOVER_OUT, function (v) { - self._hoverOut(v); - }); - views[i][j].on(BI.RelationViewRegionContainer.EVENT_PREVIEW, function (v) { - self.fireEvent(BI.RelationView.EVENT_PREVIEW, region, v); - }); - indexes[region] = {i: i, j: j}; - horizontal.push(views[i][j]); - }); - verticals.push({ - type: "bi.horizontal", - items: horizontal - }) - }); + } + return { + size: columnSize, + sum: BI.sum(columnSize) + columnSize.length + }; + }, - //求每一行的高度 - var heights = this._calculateHeights(); + _isAdaptiveColumn: function (columnSize) { + return !(BI.last(columnSize || this.table.getColumnSize()) > 1.05); + }, - //求每一列的宽度 - var widths = this._calculateWidths(); + _resizeHeader: function () { + var self = this, o = this.options; + if (o.isNeedFreeze === true) { + //若是当前处于自适应调节阶段 + if (this._isAdaptiveColumn()) { + var columnSize = this.table.getCalculateColumnSize(); + this.table.setHeaderColumnSize(columnSize); + } else { + var regionColumnSize = this.table.getClientRegionColumnSize(); + var block = this._getBlockSize(); + var sumLeft = block.sumLeft, sumRight = block.sumRight; + var columnSizeLeft = block.left, columnSizeRight = block.right; + columnSizeLeft[columnSizeLeft.length - 1] += regionColumnSize[0] - sumLeft; + columnSizeRight[columnSizeRight.length - 1] += regionColumnSize[1] - sumRight; - //求相对宽度和高度 - var offsetWidths = [0], offsetHeights = [0]; - BI.each(heights, function (i, h) { - if (i === 0) { - return; + var newLeft = BI.clone(columnSizeLeft), newRight = BI.clone(columnSizeRight); + newLeft[newLeft.length - 1] = ""; + newRight[newRight.length - 1] = ""; + this.table.setColumnSize(newLeft.concat(newRight)); + + block = self._getBlockSize(); + if (columnSizeLeft[columnSizeLeft.length - 1] < block.left[block.left.length - 1]) { + columnSizeLeft[columnSizeLeft.length - 1] = block.left[block.left.length - 1] + } + if (columnSizeRight[columnSizeRight.length - 1] < block.right[block.right.length - 1]) { + columnSizeRight[columnSizeRight.length - 1] = block.right[block.right.length - 1] + } + + self.table.setColumnSize(columnSizeLeft.concat(columnSizeRight)); } - offsetHeights[i] = offsetHeights[i - 1] + heights[i - 1]; - }); - BI.each(widths, function (i, w) { - if (i === 0) { - return; + } else { + if (!this._isAdaptiveColumn()) { + var regionColumnSize = this.table.getClientRegionColumnSize(); + var block = this._getBlockSize(); + var sum = block.sum; + var size = block.size; + + size[size.length - 1] += regionColumnSize[0] - sum; + + var newSize = BI.clone(size); + newSize[newSize.length - 1] = ""; + this.table.setColumnSize(newSize); + block = this._getBlockSize(); + + if (size[size.length - 1] < block.size[block.size.length - 1]) { + size[size.length - 1] = block.size[block.size.length - 1] + } + this.table.setColumnSize(size); } - offsetWidths[i] = offsetWidths[i - 1] + widths[i - 1]; - }); + } + }, - //画线 - var lines = this.lines = {};//缓存所有的线 - BI.each(relations, function (start, rs) { - BI.each(rs, function (end, relation) { - var startIndex = indexes[start], endIndex = indexes[end]; - var top = 0, right = 1, bottom = 2, left = 3; - var startDirection = bottom, endDirection = top; - // if (startIndex.j > endIndex.j) { - // startDirection = left; - // endDirection = right; - // } else if (startIndex.j < endIndex.j) { - // startDirection = right; - // endDirection = left; - // } else if (startIndex.i < endIndex.i) { - // startDirection = bottom; - // endDirection = top; - // } else if (startIndex.i > endIndex.i) { - // startDirection = top; - // endDirection = bottom; - // } - var draw = function (i, j, direction, isForeign) { - var x = offsetWidths[j] + (widths[j] - views[i][j].getWidth()) / 2; - var y = offsetHeights[i] + (heights[i] - views[i][j].getHeight()) / 2; - var path = "", position; - switch (direction) { - case top: - position = isForeign ? views[i][j].getTopRightPosition() : views[i][j].getTopLeftPosition(); - x += position.x; - y += position.y; - path = "M" + x + "," + y + "L" + x + "," + (y - 10); - y -= 10; - break; - case right: - position = views[i][j].getRightPosition(); - x += position.x; - y += position.y; - path = "M" + x + "," + y + "L" + (x + 10) + "," + y; - x += 10; - break; - case bottom: - position = views[i][j].getBottomPosition(); - x += position.x; - y += position.y; - path = "M" + x + "," + y + "L" + x + "," + (y + 10); - y += 10; - break; - case left: - position = views[i][j].getLeftPosition(); - x += position.x; - y += position.y; - path = "M" + x + "," + y + "L" + (x - 10) + "," + y; - x -= 10; - break; - } - return {x: x, y: y, path: path}; - }; - var path = ""; - var si = draw(startIndex.i, startIndex.j, startDirection); - var ei = draw(endIndex.i, endIndex.j, endDirection, true); - path += si.path + ei.path; - if (!lines[start]) { - lines[start] = {}; + _resizeBody: function () { + if (this._isAdaptiveColumn()) { + var columnSize = this.table.getCalculateColumnSize(); + this.setColumnSize(columnSize); + } + }, + + _adjustRegion: function () { + var o = this.options; + var regionColumnSize = this.table.getCalculateRegionColumnSize(); + if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { + var block = this._getBlockSize(); + var sumLeft = block.sumLeft, sumRight = block.sumRight; + if (sumLeft < regionColumnSize[0] || regionColumnSize[0] >= (sumLeft + sumRight)) { + this.table.setRegionColumnSize([sumLeft, "fill"]); + } + this._resizeRegion(); + } + }, + + _resizeRegion: function () { + var o = this.options; + var regionColumnSize = this.table.getCalculateRegionColumnSize(); + if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { + var maxWidth = this.table.element.width(); + if (regionColumnSize[0] < 15 || regionColumnSize[1] < 15) { + var freezeCols = o.freezeCols; + var size = maxWidth / 3; + if (freezeCols.length > o.columnSize.length / 2) { + size = maxWidth * 2 / 3; } - path += "M" + si.x + "," + si.y + "L" + ei.x + "," + ei.y; - var line = lines[start][end] = self.svg.path(path) - .attr({"stroke": c.lineColor, "stroke-width": "2"}) - .hover(function () { - line.attr("stroke", c.selectLineColor).toFront(); - storeViews[start].setValue(relation[0].primary.value); - storeViews[end].setValue(relation[0].foreign.value); - }, function () { - line.attr("stroke", c.lineColor); - storeViews[start].setValue([]); - storeViews[end].setValue([]); - }); - }); - }); - var container = BI.createWidget(); - BI.createWidget({ - type: "bi.vertical", - element: container, - items: verticals - }); - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.svg, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); + this.table.setRegionColumnSize([size, "fill"]); + } + } + }, - BI.createWidget({ - type: "bi.center_adapt", - scrollable: true, - element: this, - items: [container] - }); - } -}); -BI.RelationView.EVENT_CHANGE = "RelationView.EVENT_CHANGE"; -BI.RelationView.EVENT_PREVIEW = "EVENT_PREVIEW"; -BI.shortcut('bi.relation_view', BI.RelationView);/** - * Created by Young's on 2017/3/10. - */ -BI.RelationViewRegionContainer = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.RelationViewRegionContainer.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-relation-view-region-container", - width: 150 - }); + + resize: function () { + this.table.resize(); + this._resizeRegion(); + this._resizeHeader(); }, - _init: function () { - BI.RelationViewRegionContainer.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.region = BI.createWidget({ - type: "bi.relation_view_region", - value: o.value, - header: o.header, - text: o.text, - handler: o.handler, - items: o.items, - belongPackage: o.belongPackage - }); - this.region.on(BI.RelationViewRegion.EVENT_PREVIEW, function (v) { - self.fireEvent(BI.RelationViewRegionContainer.EVENT_PREVIEW, v); - }); - this.region.on(BI.RelationViewRegion.EVENT_HOVER_IN, function (v) { - self.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_IN, v); - }); - this.region.on(BI.RelationViewRegion.EVENT_HOVER_OUT, function (v) { - self.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_OUT, v); - }); - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [this.region], - width: this.region.getWidth(), - height: this.region.getHeight() - }); + setColumnSize: function (columnSize) { + this.table.setColumnSize(columnSize); + this._adjustRegion(); + this._resizeHeader(); }, - doRedMark: function () { - this.region.doRedMark.apply(this.region, arguments); + getColumnSize: function () { + return this.table.getColumnSize(); }, - unRedMark: function () { - this.region.unRedMark.apply(this.region, arguments); + getCalculateColumnSize: function () { + return this.table.getCalculateColumnSize(); }, - getWidth: function () { - return this.region.getWidth(); + setHeaderColumnSize: function (columnSize) { + this.table.setHeaderColumnSize(columnSize); + this._adjustRegion(); + this._resizeHeader(); }, - getHeight: function () { - return this.region.getHeight(); + setRegionColumnSize: function (columnSize) { + this.table.setRegionColumnSize(columnSize); + this._resizeHeader(); }, - //获取上方开始划线的位置 - getTopLeftPosition: function () { - return this.region.getTopLeftPosition(); + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); }, - getTopRightPosition: function () { - return this.region.getTopRightPosition(); + getCalculateRegionColumnSize: function () { + return this.table.getCalculateRegionColumnSize(); }, - getBottomPosition: function () { - return this.region.getBottomPosition(); + getCalculateRegionRowSize: function () { + return this.table.getCalculateRegionRowSize(); + }, + + getClientRegionColumnSize: function () { + return this.table.getClientRegionColumnSize(); + }, + + getScrollRegionColumnSize: function () { + return this.table.getScrollRegionColumnSize(); + }, + + getScrollRegionRowSize: function () { + return this.table.getScrollRegionRowSize(); + }, + + hasVerticalScroll: function () { + return this.table.hasVerticalScroll(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + getColumns: function () { + return this.table.getColumns(); + }, + + attr: function () { + BI.ResponisveTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + }, + + populate: function (items) { + var self = this, o = this.options; + this.table.populate.apply(this.table, arguments); + if (o.isNeedFreeze === true) { + BI.nextTick(function () { + self._initRegionSize(); + self.table.resize(); + self._resizeHeader(); + }); + } + } +}); +BI.shortcut('bi.responsive_table', BI.ResponisveTable);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.SelectTreeFirstPlusGroupNode + * @extends BI.NodeButton + */ +BI.SelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.SelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-select-tree-first-plus-group-node bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.SelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.first_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); }, - getLeftPosition: function () { - return this.region.getLeftPosition(); + isOnce: function () { + return true; }, - getRightPosition: function () { - return this.region.getRightPosition(); + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); }, - setValue: function (v) { - this.region.setValue(v); + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); }, - toggleRegion: function (v) { - v === true ? this.region.element.fadeIn() : this.region.element.fadeOut(); + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); }, - setPreviewSelected: function(v) { - this.region.setPreviewSelected(v); + setOpened: function (v) { + BI.SelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } } }); -BI.RelationViewRegionContainer.EVENT_HOVER_IN = "RelationViewRegion.EVENT_HOVER_IN"; -BI.RelationViewRegionContainer.EVENT_HOVER_OUT = "RelationViewRegion.EVENT_HOVER_OUT"; -BI.RelationViewRegionContainer.EVENT_PREVIEW = "RelationViewRegion.EVENT_PREVIEW"; -BI.shortcut("bi.relation_view_region_container", BI.RelationViewRegionContainer);/** - * 关联视图 - * - * Created by GUY on 2015/12/23. - * @class BI.RelationViewRegion - * @extends BI.BasicButton - */ -BI.RelationViewRegion = BI.inherit(BI.BasicButton, { +BI.shortcut("bi.select_tree_first_plus_group_node", BI.SelectTreeFirstPlusGroupNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.SelectTreeLastPlusGroupNode + * @extends BI.NodeButton + */ +BI.SelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { _defaultConfig: function () { - return BI.extend(BI.RelationViewRegion.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-relation-view-region cursor-pointer", - width: 150, - text: "", - value: "", - header: "", - items: [], - belongPackage: true - }); + var conf = BI.SelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-select-tree-last-plus-group-node bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) }, - _init: function () { - BI.RelationViewRegion.superclass._init.apply(this, arguments); + BI.SelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); var self = this, o = this.options; - - this.preview = BI.createWidget({ - type: "bi.icon_button", - cls: "relation-table-preview-font", - width: 25, - height: 25, + this.checkbox = BI.createWidget({ + type: "bi.last_tree_node_checkbox", stopPropagation: true - }); - this.preview.on(BI.IconButton.EVENT_CHANGE, function () { - self.fireEvent(BI.RelationViewRegion.EVENT_PREVIEW, this.isSelected()); - }); - - this.title = BI.createWidget({ + }) + this.text = BI.createWidget({ type: "bi.label", - height: 25, - width: 70, + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, text: o.text, value: o.value, - textAlign: "left" + py: o.py }); - //title放body上 - if (BI.isKey(o.header)) { - this.title.setTitle(o.header, { - container: "body" - }) - } - - this.button_group = BI.createWidget({ - type: "bi.button_group", - items: this._createItems(o.items), - layouts: [{ - type: "bi.vertical" - }] + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } }); - - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [{ - type: "bi.vertical", - cls: "relation-view-region-container bi-card bi-border " + (o.belongPackage ? "" : "other-package"), - items: [{ - type: "bi.vertical_adapt", - cls: "relation-view-region-title bi-border-bottom", - items: [this.preview, this.title] - }, this.button_group] - }], - hgap: 25, - vgap: 20 - }) + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); }, - _createItems: function (items) { - var self = this; - return BI.map(items, function (i, item) { - return BI.extend(item, { - type: "bi.relation_view_item", - hoverIn: function () { - self.setValue(item.value); - self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN, item.value); - }, - hoverOut: function () { - self.setValue([]); - self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_OUT, item.value); - } - }) - }); + isOnce: function () { + return true; }, doRedMark: function () { - this.title.doRedMark.apply(this.title, arguments); + this.text.doRedMark.apply(this.text, arguments); }, unRedMark: function () { - this.title.unRedMark.apply(this.title, arguments); - }, - - getWidth: function () { - return this.options.width; + this.text.unRedMark.apply(this.text, arguments); }, - getHeight: function () { - return this.button_group.getAllButtons().length * 25 + 25 + 2 * 20 + 3; + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); }, - //获取上方开始划线的位置 - getTopLeftPosition: function () { - return { - x: 25 + 10, - y: 20 + setOpened: function (v) { + BI.SelectTreeLastPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); } - }, + } +}); - getTopRightPosition: function () { - return { - x: this.getWidth() - 25 - 10, - y: 20 - } +BI.shortcut("bi.select_tree_last_plus_group_node", BI.SelectTreeLastPlusGroupNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.SelectTreeMidPlusGroupNode + * @extends BI.NodeButton + */ +BI.SelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.SelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-select-tree-mid-plus-group-node bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) }, - - getBottomPosition: function () { - return { - x: 25 + 10, - y: this.getHeight() - 20 - } + _init: function () { + BI.SelectTreeMidPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.mid_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); }, - getLeftPosition: function () { - return { - x: 25, - y: 20 + 10 - } + isOnce: function () { + return true; }, - getRightPosition: function () { - return { - x: this.getWidth() - 25, - y: 20 + 10 - } + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); }, - setValue: function (v) { - this.button_group.setValue(v); + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); }, - setPreviewSelected: function(v) { - this.preview.setSelected(v); + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + }, + + setOpened: function (v) { + BI.SelectTreeMidPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } } }); -BI.RelationViewRegion.EVENT_HOVER_IN = "RelationViewRegion.EVENT_HOVER_IN"; -BI.RelationViewRegion.EVENT_HOVER_OUT = "RelationViewRegion.EVENT_HOVER_OUT"; -BI.RelationViewRegion.EVENT_PREVIEW = "RelationViewRegion.EVENT_PREVIEW"; -BI.shortcut('bi.relation_view_region', BI.RelationViewRegion);/** - * 自适应宽度的表格 - * - * Created by GUY on 2016/2/3. - * @class BI.ResponisveTable + +BI.shortcut("bi.select_tree_mid_plus_group_node", BI.SelectTreeMidPlusGroupNode);/** + * @class BI.SelectTreeCombo * @extends BI.Widget */ -BI.ResponisveTable = BI.inherit(BI.Widget, { - - _const: { - perColumnSize: 100 - }, +BI.SelectTreeCombo = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.ResponisveTable.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-responsive-table", - isNeedFreeze: false,//是否需要冻结单元格 - freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 - - isNeedMerge: false,//是否需要合并单元格 - mergeCols: [], //合并的单元格列号 - mergeRule: function (row1, row2) { //合并规则, 默认相等时合并 - return BI.isEqual(row1, row2); - }, - - columnSize: [], - headerRowSize: 25, - footerRowSize: 25, - rowSize: 25, - - regionColumnSize: false, - - header: [], - footer: false, - items: [], //二维数组 - - //交叉表头 - crossHeader: [], - crossItems: [] + return BI.extend(BI.SelectTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-tree-combo", + height: 30, + text: "", + items: [] }); }, _init: function () { - BI.ResponisveTable.superclass._init.apply(this, arguments); + BI.SelectTreeCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.table = BI.createWidget({ - type: "bi.table_view", - element: this, - - isNeedFreeze: o.isNeedFreeze, - freezeCols: o.freezeCols, - - isNeedMerge: o.isNeedMerge, - mergeCols: o.mergeCols, - mergeRule: o.mergeRule, - - columnSize: o.columnSize, - headerRowSize: o.headerRowSize, - footerRowSize: o.footerRowSize, - rowSize: o.rowSize, - - regionColumnSize: o.regionColumnSize, - - header: o.header, - footer: o.footer, - items: o.items, - //交叉表头 - crossHeader: o.crossHeader, - crossItems: o.crossItems - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () { - self._initRegionSize(); - self.table.resize(); - self._resizeHeader(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () { - self._resizeRegion(); - self._resizeHeader(); - self.fireEvent(BI.Table.EVENT_TABLE_RESIZE, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { - self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + this.trigger = BI.createWidget({ + type: "bi.single_tree_trigger", + text: o.text, + height: o.height, + items: o.items }); - this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, function () { - self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, arguments); + + this.popup = BI.createWidget({ + type: "bi.select_level_tree", + items: o.items }); - this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE, function () { - //important:在冻结并自适应列宽的情况下要随时变更表头宽度 - if (o.isNeedResize === true && self._isAdaptiveColumn()) { - self._resizeHeader(); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup } - self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { - self._resizeHeader(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); }); - this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, function () { - self._resizeBody(); - self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE, function () { - self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { - self._resizeRegion(); - self._resizeHeader(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + this.combo.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); - }, - _initRegionSize: function () { - var o = this.options; - if (o.isNeedFreeze === true) { - var regionColumnSize = this.table.getRegionColumnSize(); - var maxWidth = this.table.element.width(); - if (!regionColumnSize[0] || (regionColumnSize[0] === 'fill') || regionColumnSize[0] > maxWidth || regionColumnSize[1] > maxWidth) { - var freezeCols = o.freezeCols; - if (freezeCols.length === 0) { - this.table.setRegionColumnSize([0, "fill"]); - } else if (freezeCols.length > 0 && freezeCols.length < o.columnSize.length) { - var size = maxWidth / 3; - if (freezeCols.length > o.columnSize.length / 2) { - size = maxWidth * 2 / 3; - } - this.table.setRegionColumnSize([size, "fill"]); - } else { - this.table.setRegionColumnSize(["fill", 0]); - } - } - } + this.popup.on(BI.SingleTreePopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + }); }, - _getBlockSize: function () { - var o = this.options; - var columnSize = this.table.getCalculateColumnSize(); - if (o.isNeedFreeze === true) { - var columnSizeLeft = [], columnSizeRight = []; - BI.each(columnSize, function (i, size) { - if (o.freezeCols.contains(i)) { - columnSizeLeft.push(size); - } else { - columnSizeRight.push(size); - } - }); - //因为有边框,所以加上数组长度的参数调整 - var sumLeft = BI.sum(columnSizeLeft) + columnSizeLeft.length, - sumRight = BI.sum(columnSizeRight) + columnSizeRight.length; - return { - sumLeft: sumLeft, - sumRight: sumRight, - left: columnSizeLeft, - right: columnSizeRight - } - } - return { - size: columnSize, - sum: BI.sum(columnSize) + columnSize.length - }; + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.trigger.setValue(v); + this.popup.setValue(v); }, - _isAdaptiveColumn: function (columnSize) { - return !(BI.last(columnSize || this.table.getColumnSize()) > 1.05); + getValue: function () { + return this.popup.getValue(); }, - _resizeHeader: function () { - var self = this, o = this.options; - if (o.isNeedFreeze === true) { - //若是当前处于自适应调节阶段 - if (this._isAdaptiveColumn()) { - var columnSize = this.table.getCalculateColumnSize(); - this.table.setHeaderColumnSize(columnSize); - } else { - var regionColumnSize = this.table.getClientRegionColumnSize(); - var block = this._getBlockSize(); - var sumLeft = block.sumLeft, sumRight = block.sumRight; - var columnSizeLeft = block.left, columnSizeRight = block.right; - columnSizeLeft[columnSizeLeft.length - 1] += regionColumnSize[0] - sumLeft; - columnSizeRight[columnSizeRight.length - 1] += regionColumnSize[1] - sumRight; - - var newLeft = BI.clone(columnSizeLeft), newRight = BI.clone(columnSizeRight); - newLeft[newLeft.length - 1] = ""; - newRight[newRight.length - 1] = ""; - this.table.setColumnSize(newLeft.concat(newRight)); + populate: function (items) { + this.combo.populate(items); + } +}); - block = self._getBlockSize(); - if (columnSizeLeft[columnSizeLeft.length - 1] < block.left[block.left.length - 1]) { - columnSizeLeft[columnSizeLeft.length - 1] = block.left[block.left.length - 1] - } - if (columnSizeRight[columnSizeRight.length - 1] < block.right[block.right.length - 1]) { - columnSizeRight[columnSizeRight.length - 1] = block.right[block.right.length - 1] - } - self.table.setColumnSize(columnSizeLeft.concat(columnSizeRight)); - } - } else { - if (!this._isAdaptiveColumn()) { - var regionColumnSize = this.table.getClientRegionColumnSize(); - var block = this._getBlockSize(); - var sum = block.sum; - var size = block.size; +BI.shortcut("bi.select_tree_combo", BI.SelectTreeCombo);/** + * @class BI.SelectTreeExpander + * @extends BI.Widget + */ +BI.SelectTreeExpander = BI.inherit(BI.Widget, { - size[size.length - 1] += regionColumnSize[0] - sum; + _defaultConfig: function () { + return BI.extend(BI.SelectTreeExpander.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-tree-expander", + trigger: "click", + toggle: true, + direction: "bottom", + isDefaultInit: true, + el: {}, + popup: {} + }); + }, - var newSize = BI.clone(size); - newSize[newSize.length - 1] = ""; - this.table.setColumnSize(newSize); - block = this._getBlockSize(); + _init: function () { + BI.SelectTreeExpander.superclass._init.apply(this, arguments); + var self = this, o = this.options; - if (size[size.length - 1] < block.size[block.size.length - 1]) { - size[size.length - 1] = block.size[block.size.length - 1] + this.trigger = BI.createWidget(BI.extend({stopPropagation: true}, o.el)); + this.trigger.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.expander.setValue([]); } - this.table.setColumnSize(size); } - } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.expander = BI.createWidget({ + type: "bi.expander", + element: this, + trigger: o.trigger, + toggle: o.toggle, + direction: o.direction, + isDefaultInit: o.isDefaultInit, + el: this.trigger, + popup: o.popup + }); + this.expander.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.trigger.setSelected(false); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); }, - _resizeBody: function () { - if (this._isAdaptiveColumn()) { - var columnSize = this.table.getCalculateColumnSize(); - this.setColumnSize(columnSize); + setValue: function (v) { + if (BI.contains(v, this.trigger.getValue())) { + this.trigger.setSelected(true); + this.expander.setValue([]); + } else { + this.trigger.setSelected(false); + this.expander.setValue(v); } }, - _adjustRegion: function () { - var o = this.options; - var regionColumnSize = this.table.getCalculateRegionColumnSize(); - if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { - var block = this._getBlockSize(); - var sumLeft = block.sumLeft, sumRight = block.sumRight; - if (sumLeft < regionColumnSize[0] || regionColumnSize[0] >= (sumLeft + sumRight)) { - this.table.setRegionColumnSize([sumLeft, "fill"]); - } - this._resizeRegion(); + getValue: function () { + if (this.trigger.isSelected()) { + return [this.trigger.getValue()]; } + return this.expander.getValue(); }, - _resizeRegion: function () { - var o = this.options; - var regionColumnSize = this.table.getCalculateRegionColumnSize(); - if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { - var maxWidth = this.table.element.width(); - if (regionColumnSize[0] < 15 || regionColumnSize[1] < 15) { - var freezeCols = o.freezeCols; - var size = maxWidth / 3; - if (freezeCols.length > o.columnSize.length / 2) { - size = maxWidth * 2 / 3; + populate: function (items) { + this.expander.populate(items); + } +}); + +BI.shortcut("bi.select_tree_expander", BI.SelectTreeExpander);/** + * @class BI.SelectTreePopup + * @extends BI.Pane + */ + +BI.SelectTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-level-tree", + tipText: BI.i18nText("BI-No_Selected_Item"), + items: [] + }); + }, + + _formatItems: function (nodes, layer) { + var self = this; + BI.each(nodes, function (i, node) { + var extend = {layer: layer}; + node.id = node.id || BI.UUID(); + if (node.isParent === true || BI.isNotEmptyArray(node.children)) { + switch (i) { + case 0 : + extend.type = "bi.select_tree_first_plus_group_node"; + break; + case nodes.length - 1 : + extend.type = "bi.select_tree_last_plus_group_node"; + break; + default : + extend.type = "bi.select_tree_mid_plus_group_node"; + break; } - this.table.setRegionColumnSize([size, "fill"]); + BI.defaults(node, extend); + self._formatItems(node.children); + } else { + switch (i) { + case nodes.length - 1: + extend.type = "bi.last_tree_leaf_item"; + break; + default : + extend.type = "bi.mid_tree_leaf_item"; + } + BI.defaults(node, extend); } - } + }); + return nodes; }, + _init: function () { + BI.SelectTreePopup.superclass._init.apply(this, arguments); - resize: function () { - this.table.resize(); - this._resizeRegion(); - this._resizeHeader(); - }, + var self = this, o = this.options; - setColumnSize: function (columnSize) { - this.table.setColumnSize(columnSize); - this._adjustRegion(); - this._resizeHeader(); - }, + this.tree = BI.createWidget({ + type: 'bi.level_tree', + expander: { + type: "bi.select_tree_expander", + isDefaultInit: true + }, + items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), + chooseType: BI.Selection.Single + }); - getColumnSize: function () { - return this.table.getColumnSize(); - }, + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.tree] + }); - getCalculateColumnSize: function () { - return this.table.getCalculateColumnSize(); + this.tree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.tree.on(BI.LevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.SelectTreePopup.EVENT_CHANGE); + }); + + this.check(); }, - setHeaderColumnSize: function (columnSize) { - this.table.setHeaderColumnSize(columnSize); - this._adjustRegion(); - this._resizeHeader(); + getValue: function () { + return this.tree.getValue(); }, - setRegionColumnSize: function (columnSize) { - this.table.setRegionColumnSize(columnSize); - this._resizeHeader(); + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.tree.setValue(v); }, - getRegionColumnSize: function () { - return this.table.getRegionColumnSize(); + populate: function (items) { + BI.SelectTreePopup.superclass.populate.apply(this, arguments); + this.tree.populate(items); + } +}); + +BI.SelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.select_level_tree", BI.SelectTreePopup);/** + * + * Created by GUY on 2016/8/10. + * @class BI.SequenceTableDynamicNumber + * @extends BI.SequenceTableTreeNumber + */ +BI.SequenceTableDynamicNumber = BI.inherit(BI.SequenceTableTreeNumber, { + + _defaultConfig: function () { + return BI.extend(BI.SequenceTableDynamicNumber.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-sequence-table-dynamic-number" + }); }, - getCalculateRegionColumnSize: function () { - return this.table.getCalculateRegionColumnSize(); + _init: function () { + BI.SequenceTableDynamicNumber.superclass._init.apply(this, arguments); }, - getCalculateRegionRowSize: function () { - return this.table.getCalculateRegionRowSize(); - }, + _formatNumber: function (nodes) { + var self = this, o = this.options; + var result = []; + var count = this._getStart(nodes); + + function getLeafCount(node) { + var cnt = 0; + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + cnt += getLeafCount(child); + }); + if (node.children.length > 1 && BI.isNotEmptyArray(node.values)) { + cnt++; + } + } else { + cnt++; + } + return cnt; + } + + var start = 0, top = 0; + BI.each(nodes, function (i, node) { + if (BI.isArray(node.children)) { + BI.each(node.children, function (index, child) { + var cnt = getLeafCount(child); + result.push({ + text: count++, + start: start, + top: top, + cnt: cnt, + index: index, + height: cnt * o.rowSize + }); + start += cnt; + top += cnt * o.rowSize; + }); + if (BI.isNotEmptyArray(node.values)) { + result.push({ + text: BI.i18nText("BI-Summary_Values"), + start: start++, + top: top, + cnt: 1, + isSummary: true, + height: o.rowSize + }); + top += o.rowSize; + } + } + }); + return result; + } +}); +BI.shortcut('bi.sequence_table_dynamic_number', BI.SequenceTableDynamicNumber);/** + * + * Created by GUY on 2016/5/26. + * @class BI.SequenceTableListNumber + * @extends BI.Widget + */ +BI.SequenceTableListNumber = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SequenceTableListNumber.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-sequence-table-list-number", + isNeedFreeze: false, + scrollTop: 0, + startSequence: 1,//开始的序号 + headerRowSize: 25, + rowSize: 25, - getClientRegionColumnSize: function () { - return this.table.getClientRegionColumnSize(); - }, + sequenceHeaderCreator: null, - getScrollRegionColumnSize: function () { - return this.table.getScrollRegionColumnSize(); - }, + header: [], + items: [], //二维数组 - getScrollRegionRowSize: function () { - return this.table.getScrollRegionRowSize(); - }, + //交叉表头 + crossHeader: [], + crossItems: [], - hasVerticalScroll: function () { - return this.table.hasVerticalScroll(); + pageSize: 20 + }); }, - setVerticalScroll: function (scrollTop) { - this.table.setVerticalScroll(scrollTop); - }, + _init: function () { + BI.SequenceTableListNumber.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.start = o.startSequence; + this.renderedCells = []; + this.renderedKeys = []; - setLeftHorizontalScroll: function (scrollLeft) { - this.table.setLeftHorizontalScroll(scrollLeft); - }, + this.container = BI.createWidget({ + type: "bi.absolute", + width: 60, + scrollable: false + }); - setRightHorizontalScroll: function (scrollLeft) { - this.table.setRightHorizontalScroll(scrollLeft); - }, + this.scrollContainer = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.container] + }); - getVerticalScroll: function () { - return this.table.getVerticalScroll(); - }, + this.headerContainer = BI.createWidget({ + type: "bi.absolute", + cls: "bi-border", + width: 58, + scrollable: false + }); - getLeftHorizontalScroll: function () { - return this.table.getLeftHorizontalScroll(); + this.layout = BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.headerContainer, + height: o.headerRowSize * o.header.length - 2 + }, { + el: {type: "bi.layout"}, + height: 2 + }, { + el: this.scrollContainer + }] + }); + this._populate(); }, - getRightHorizontalScroll: function () { - return this.table.getRightHorizontalScroll(); - }, + _layout: function () { + var self = this, o = this.options; + var headerHeight = o.headerRowSize * o.header.length - 2; + var items = this.layout.attr("items"); + if (o.isNeedFreeze === false) { + items[0].height = 0; + items[1].height = 0; + } else if (o.isNeedFreeze === true) { + items[0].height = headerHeight; + items[1].height = 2; + } + this.layout.attr("items", items); + this.layout.resize(); + this.container.setHeight(o.items.length * o.rowSize); + try { + this.scrollContainer.element.scrollTop(o.scrollTop); + } catch (e) { - getColumns: function () { - return this.table.getColumns(); + } }, - attr: function () { - BI.ResponisveTable.superclass.attr.apply(this, arguments); - this.table.attr.apply(this.table, arguments); + _createHeader: function () { + var o = this.options; + BI.createWidget({ + type: "bi.absolute", + element: this.headerContainer, + items: [{ + el: o.sequenceHeaderCreator || { + type: "bi.table_style_cell", + cls: "sequence-table-title-cell", + styleGetter: o.headerCellStyleGetter, + text: BI.i18nText("BI-Number_Index") + }, + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + }); }, - populate: function (items) { + _calculateChildrenToRender: function () { var self = this, o = this.options; - this.table.populate.apply(this.table, arguments); - if (o.isNeedFreeze === true) { - BI.nextTick(function () { - self._initRegionSize(); - self.table.resize(); - self._resizeHeader(); - }); + var scrollTop = BI.clamp(o.scrollTop, 0, o.rowSize * o.items.length - (o.height - o.header.length * o.headerRowSize) + BI.DOM.getScrollWidth()); + var start = Math.floor(scrollTop / o.rowSize); + var end = start + Math.floor((o.height - o.header.length * o.headerRowSize) / o.rowSize); + var renderedCells = [], renderedKeys = []; + for (var i = start, cnt = 0; i <= end && i < o.items.length; i++, cnt++) { + var index = BI.deepIndexOf(this.renderedKeys, this.start + i); + var top = i * o.rowSize; + if (index > -1) { + if (o.rowSize !== this.renderedCells[index]._height) { + this.renderedCells[index]._height = o.rowSize; + this.renderedCells[index].el.setHeight(o.rowSize); + } + if (this.renderedCells[index].top !== top) { + this.renderedCells[index].top = top; + this.renderedCells[index].el.element.css("top", top + "px"); + } + renderedCells.push(this.renderedCells[index]); + } else { + var child = BI.createWidget(BI.extend({ + type: "bi.table_style_cell", + cls: "sequence-table-number-cell bi-border-left bi-border-right bi-border-bottom", + width: 60, + height: o.rowSize, + text: this.start + i, + styleGetter: function (index) { + return function () { + return o.sequenceCellStyleGetter(self.start + i - 1); + } + }(cnt) + })); + renderedCells.push({ + el: child, + left: 0, + top: top, + _height: o.rowSize + }); + } + renderedKeys.push(this.start + i); } - } -}); -BI.shortcut('bi.responsive_table', BI.ResponisveTable);/** - * 加号表示的组节点 - * Created by GUY on 2015/9/6. - * @class BI.SelectTreeFirstPlusGroupNode - * @extends BI.NodeButton - */ -BI.SelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { - _defaultConfig: function () { - var conf = BI.SelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-select-tree-first-plus-group-node bi-list-item-active", - logic: { - dynamic: false - }, - id: "", - pId: "", - readonly: true, - open: false, - height: 25 - }) - }, - _init: function () { - BI.SelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.checkbox = BI.createWidget({ - type: "bi.first_tree_node_checkbox", - stopPropagation: true - }); - this.text = BI.createWidget({ - type: "bi.label", - textAlign: "left", - whiteSpace: "nowrap", - textHeight: o.height, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py + + //已存在的, 需要添加的和需要删除的 + var existSet = {}, addSet = {}, deleteArray = []; + BI.each(renderedKeys, function (i, key) { + if (BI.deepContains(self.renderedKeys, key)) { + existSet[i] = key; + } else { + addSet[i] = key; + } }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - if (this.isSelected()) { - self.triggerExpand(); - } else { - self.triggerCollapse(); - } + BI.each(this.renderedKeys, function (i, key) { + if (BI.deepContains(existSet, key)) { + return; + } + if (BI.deepContains(addSet, key)) { + return; } + deleteArray.push(i); + }); + BI.each(deleteArray, function (i, index) { + self.renderedCells[index].el.destroy(); + }); + var addedItems = []; + BI.each(addSet, function (index) { + addedItems.push(renderedCells[index]) + }); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: addedItems }); - var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); - var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { - width: 25, - el: this.checkbox - }, this.text); - BI.createWidget(BI.extend({ - element: this - }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { - items: items - })))); - }, - - isOnce: function () { - return true; - }, - - doRedMark: function () { - this.text.doRedMark.apply(this.text, arguments); - }, - - unRedMark: function () { - this.text.unRedMark.apply(this.text, arguments); + this.renderedCells = renderedCells; + this.renderedKeys = renderedKeys; }, - doClick: function () { - BI.NodeButton.superclass.doClick.apply(this, arguments); + _populate: function () { + this.headerContainer.empty(); + this._createHeader(); + this._layout(); + this._calculateChildrenToRender(); }, - setOpened: function (v) { - BI.SelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); - if (BI.isNotNull(this.checkbox)) { - this.checkbox.setSelected(v); - } - } -}); + setVerticalScroll: function (scrollTop) { + if (this.options.scrollTop !== scrollTop) { + this.options.scrollTop = scrollTop; + try { + this.scrollContainer.element.scrollTop(scrollTop); + } catch (e) { -BI.shortcut("bi.select_tree_first_plus_group_node", BI.SelectTreeFirstPlusGroupNode);/** - * 加号表示的组节点 - * Created by GUY on 2015/9/6. - * @class BI.SelectTreeLastPlusGroupNode - * @extends BI.NodeButton - */ -BI.SelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { - _defaultConfig: function () { - var conf = BI.SelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-select-tree-last-plus-group-node bi-list-item-active", - logic: { - dynamic: false - }, - id: "", - pId: "", - readonly: true, - open: false, - height: 25 - }) - }, - _init: function () { - BI.SelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.checkbox = BI.createWidget({ - type: "bi.last_tree_node_checkbox", - stopPropagation: true - }) - this.text = BI.createWidget({ - type: "bi.label", - textAlign: "left", - whiteSpace: "nowrap", - textHeight: o.height, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py - }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - if (this.isSelected()) { - self.triggerExpand(); - } else { - self.triggerCollapse(); - } } - }); - var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); - var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { - width: 25, - el: this.checkbox - }, this.text); - BI.createWidget(BI.extend({ - element: this - }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { - items: items - })))); + } }, - isOnce: function () { - return true; + getVerticalScroll: function () { + return this.options.scrollTop; }, - doRedMark: function () { - this.text.doRedMark.apply(this.text, arguments); + setVPage: function (v) { + v = v < 1 ? 1 : v; + var o = this.options; + this.start = (v - 1) * o.pageSize + 1; }, - unRedMark: function () { - this.text.unRedMark.apply(this.text, arguments); + _restore: function () { + var o = this.options; + BI.each(this.renderedCells, function (i, cell) { + cell.el.destroy(); + }); + this.renderedCells = []; + this.renderedKeys = []; }, - doClick: function () { - BI.NodeButton.superclass.doClick.apply(this, arguments); + restore: function () { + this._restore(); }, - setOpened: function (v) { - BI.SelectTreeLastPlusGroupNode.superclass.setOpened.apply(this, arguments); - if (BI.isNotNull(this.checkbox)) { - this.checkbox.setSelected(v); + populate: function (items, header) { + var o = this.options; + if (items && items !== this.options.items) { + o.items = items; + this._restore(); + } + if (header && header !== this.options.header) { + o.header = header; } + this._populate(); } }); - -BI.shortcut("bi.select_tree_last_plus_group_node", BI.SelectTreeLastPlusGroupNode);/** - * 加号表示的组节点 - * Created by GUY on 2015/9/6. - * @class BI.SelectTreeMidPlusGroupNode - * @extends BI.NodeButton +BI.shortcut('bi.sequence_table_list_number', BI.SequenceTableListNumber);/** + * 带有序号的表格 + * + * Created by GUY on 2016/5/26. + * @class BI.SequenceTable + * @extends BI.Widget */ -BI.SelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { +BI.SequenceTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { - var conf = BI.SelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-select-tree-mid-plus-group-node bi-list-item-active", - logic: { - dynamic: false + return BI.extend(BI.SequenceTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-sequence-table", + el: { + type: "bi.adaptive_table" }, - id: "", - pId: "", - readonly: true, - open: false, - height: 25 - }) - }, - _init: function () { - BI.SelectTreeMidPlusGroupNode.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.checkbox = BI.createWidget({ - type: "bi.mid_tree_node_checkbox", - stopPropagation: true - }); - this.text = BI.createWidget({ - type: "bi.label", - textAlign: "left", - whiteSpace: "nowrap", - textHeight: o.height, - height: o.height, - hgap: o.hgap, - text: o.text, - value: o.value, - py: o.py - }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - if (this.isSelected()) { - self.triggerExpand(); - } else { - self.triggerCollapse(); - } - } - }); - var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); - var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { - width: 25, - el: this.checkbox - }, this.text); - BI.createWidget(BI.extend({ - element: this - }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { - items: items - })))); - }, - isOnce: function () { - return true; - }, + sequence: {}, - doRedMark: function () { - this.text.doRedMark.apply(this.text, arguments); - }, + isNeedResize: true, + isResizeAdapt: false, - unRedMark: function () { - this.text.unRedMark.apply(this.text, arguments); - }, + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 - doClick: function () { - BI.NodeButton.superclass.doClick.apply(this, arguments); - }, + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: BI.emptyFn, - setOpened: function (v) { - BI.SelectTreeMidPlusGroupNode.superclass.setOpened.apply(this, arguments); - if (BI.isNotNull(this.checkbox)) { - this.checkbox.setSelected(v); - } - } -}); + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + rowSize: 25, -BI.shortcut("bi.select_tree_mid_plus_group_node", BI.SelectTreeMidPlusGroupNode);/** - * @class BI.SelectTreeCombo - * @extends BI.Widget - */ -BI.SelectTreeCombo = BI.inherit(BI.Widget, { + regionColumnSize: [], + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [], - _defaultConfig: function () { - return BI.extend(BI.SelectTreeCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-select-tree-combo", - height: 30, - text: "", - items: [] + showSequence: false, + startSequence: 1//开始的序号 }); }, _init: function () { - BI.SelectTreeCombo.superclass._init.apply(this, arguments); + BI.SequenceTable.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.single_tree_trigger", - text: o.text, - height: o.height, - items: o.items - }); - - this.popup = BI.createWidget({ - type: "bi.select_level_tree", - items: o.items - }); - - this.combo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup - } - }); - - this.combo.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + this.sequence = BI.createWidget(o.sequence, { + type: "bi.sequence_table_list_number", + invisible: o.showSequence === false, + startSequence: o.startSequence, + isNeedFreeze: o.isNeedFreeze, + header: o.header, + items: o.items, + crossHeader: o.crossHeader, + crossItems: o.crossItems, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + width: 60, + height: o.height && o.height - BI.GridTableScrollbar.SIZE, - this.popup.on(BI.SingleTreePopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.combo.hideView(); + headerCellStyleGetter: o.headerCellStyleGetter, + summaryCellStyleGetter: o.summaryCellStyleGetter, + sequenceCellStyleGetter: o.sequenceCellStyleGetter }); - }, + this.table = BI.createWidget(o.el, { + type: "bi.adaptive_table", + width: o.showSequence === true ? o.width - 60 : o.width, + height: o.height, + isNeedResize: o.isNeedResize, + isResizeAdapt: o.isResizeAdapt, - setValue: function (v) { - v = BI.isArray(v) ? v : [v]; - this.trigger.setValue(v); - this.popup.setValue(v); - }, + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, - getValue: function () { - return this.popup.getValue(); - }, + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, - populate: function (items) { - this.combo.populate(items); - } -}); + columnSize: o.columnSize, + minColumnSize: o.minColumnSize, + maxColumnSize: o.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + regionColumnSize: o.regionColumnSize, -BI.shortcut("bi.select_tree_combo", BI.SelectTreeCombo);/** - * @class BI.SelectTreeExpander - * @extends BI.Widget - */ -BI.SelectTreeExpander = BI.inherit(BI.Widget, { + headerCellStyleGetter: o.headerCellStyleGetter, + summaryCellStyleGetter: o.summaryCellStyleGetter, + sequenceCellStyleGetter: o.sequenceCellStyleGetter, - _defaultConfig: function () { - return BI.extend(BI.SelectTreeExpander.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-select-tree-expander", - trigger: "click", - toggle: true, - direction: "bottom", - isDefaultInit: true, - el: {}, - popup: {} + header: o.header, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems }); - }, - - _init: function () { - BI.SelectTreeExpander.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget(BI.extend({stopPropagation: true}, o.el)); - this.trigger.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - if (this.isSelected()) { - self.expander.setValue([]); - } + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function (scroll) { + if (self.sequence.getVerticalScroll() !== this.getVerticalScroll()) { + self.sequence.setVerticalScroll(this.getVerticalScroll()); + self.sequence.populate(); } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); }); - this.expander = BI.createWidget({ - type: "bi.expander", + this.htape = BI.createWidget({ + type: "bi.absolute", element: this, - trigger: o.trigger, - toggle: o.toggle, - direction: o.direction, - isDefaultInit: o.isDefaultInit, - el: this.trigger, - popup: o.popup - }); - this.expander.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - self.trigger.setSelected(false); - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + items: [{ + el: this.sequence, + left: 0, + top: 0 + }, { + el: this.table, + top: 0, + left: o.showSequence === true ? 60 : 0 + }] }); + this._populate(); }, - setValue: function (v) { - if (BI.contains(v, this.trigger.getValue())) { - this.trigger.setSelected(true); - this.expander.setValue([]); + _populate: function () { + var o = this.options; + if (o.showSequence === true) { + this.sequence.setVisible(true); + this.table.element.css("left", "60px"); + this.table.setWidth(o.width - 60); } else { - this.trigger.setSelected(false); - this.expander.setValue(v); + this.sequence.setVisible(false); + this.table.element.css("left", "0px"); + this.table.setWidth(o.width); } }, - getValue: function () { - if (this.trigger.isSelected()) { - return [this.trigger.getValue()]; - } - return this.expander.getValue(); + setWidth: function (width) { + BI.PageTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(this.options.showSequence ? width - 60 : width); }, - populate: function (items) { - this.expander.populate(items); - } -}); + setHeight: function (height) { + BI.PageTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + this.sequence.setHeight(height - BI.GridTableScrollbar.SIZE); + }, -BI.shortcut("bi.select_tree_expander", BI.SelectTreeExpander);/** - * @class BI.SelectTreePopup - * @extends BI.Pane - */ + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setColumnSize(columnSize); + }, -BI.SelectTreePopup = BI.inherit(BI.Pane, { + getColumnSize: function () { + return this.table.getColumnSize(); + }, - _defaultConfig: function () { - return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-select-level-tree", - tipText: BI.i18nText("BI-No_Selected_Item"), - items: [] - }); + setRegionColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setRegionColumnSize(columnSize); }, - _formatItems: function (nodes, layer) { - var self = this; - BI.each(nodes, function (i, node) { - var extend = {layer: layer}; - node.id = node.id || BI.UUID(); - if (node.isParent === true || BI.isNotEmptyArray(node.children)) { - switch (i) { - case 0 : - extend.type = "bi.select_tree_first_plus_group_node"; - break; - case nodes.length - 1 : - extend.type = "bi.select_tree_last_plus_group_node"; - break; - default : - extend.type = "bi.select_tree_mid_plus_group_node"; - break; - } - BI.defaults(node, extend); - self._formatItems(node.children); - } else { - switch (i) { - case nodes.length - 1: - extend.type = "bi.last_tree_leaf_item"; - break; - default : - extend.type = "bi.mid_tree_leaf_item"; - } - BI.defaults(node, extend); - } - }); - return nodes; + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + hasLeftHorizontalScroll: function () { + return this.table.hasLeftHorizontalScroll(); + }, + + hasRightHorizontalScroll: function () { + return this.table.hasRightHorizontalScroll(); }, - _init: function () { - BI.SelectTreePopup.superclass._init.apply(this, arguments); + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, - var self = this, o = this.options; + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, - this.tree = BI.createWidget({ - type: 'bi.level_tree', - expander: { - type: "bi.select_tree_expander", - isDefaultInit: true - }, - items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), - chooseType: BI.Selection.Single - }); + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + this.sequence.setVerticalScroll(scrollTop); + }, - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [this.tree] - }); + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, - this.tree.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); + setVPage: function (page) { + this.sequence.setVPage && this.sequence.setVPage(page); + }, - this.tree.on(BI.LevelTree.EVENT_CHANGE, function () { - self.fireEvent(BI.SelectTreePopup.EVENT_CHANGE); - }); + setHPage: function (page) { + this.sequence.setHPage && this.sequence.setHPage(page); + }, - this.check(); + attr: function () { + BI.SequenceTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + this.sequence.attr.apply(this.sequence, arguments); }, - getValue: function () { - return this.tree.getValue(); + restore: function () { + this.table.restore(); + this.sequence.restore(); }, - setValue: function (v) { - v = BI.isArray(v) ? v : [v]; - this.tree.setValue(v); + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + if (items) { + o.items = items; + } + if (header) { + o.header = header; + } + if (crossItems) { + o.crossItems = crossItems; + } + if (crossHeader) { + o.crossHeader = crossHeader; + } + this._populate(); + this.table.populate.apply(this.table, arguments); + this.sequence.populate.apply(this.sequence, arguments); + this.sequence.setVerticalScroll(this.table.getVerticalScroll()); }, - populate: function (items) { - BI.SelectTreePopup.superclass.populate.apply(this, arguments); - this.tree.populate(items); + destroy: function () { + this.table.destroy(); + BI.SequenceTable.superclass.destroy.apply(this, arguments); } }); - -BI.SelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.select_level_tree", BI.SelectTreePopup);/** - * - * Created by GUY on 2016/8/10. - * @class BI.SequenceTableDynamicNumber - * @extends BI.SequenceTableTreeNumber +BI.shortcut('bi.sequence_table', BI.SequenceTable);/** + * Created by zcf on 2016/9/22. */ -BI.SequenceTableDynamicNumber = BI.inherit(BI.SequenceTableTreeNumber, { - +BI.SliderIconButton = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.SequenceTableDynamicNumber.superclass._defaultConfig.apply(this, arguments), { - extraCls: "bi-sequence-table-dynamic-number" + return BI.extend(BI.SliderIconButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-slider-button" }); }, - _init: function () { - BI.SequenceTableDynamicNumber.superclass._init.apply(this, arguments); - }, - - _formatNumber: function (nodes) { - var self = this, o = this.options; - var result = []; - var count = this._getStart(nodes); - - function getLeafCount(node) { - var cnt = 0; - if (BI.isNotEmptyArray(node.children)) { - BI.each(node.children, function (index, child) { - cnt += getLeafCount(child); - }); - if (node.children.length > 1 && BI.isNotEmptyArray(node.values)) { - cnt++; - } - } else { - cnt++; - } - return cnt; - } - - var start = 0, top = 0; - BI.each(nodes, function (i, node) { - if (BI.isArray(node.children)) { - BI.each(node.children, function (index, child) { - var cnt = getLeafCount(child); - result.push({ - text: count++, - start: start, - top: top, - cnt: cnt, - index: index, - height: cnt * o.rowSize - }); - start += cnt; - top += cnt * o.rowSize; - }); - if (BI.isNotEmptyArray(node.values)) { - result.push({ - text: BI.i18nText("BI-Summary_Values"), - start: start++, - top: top, - cnt: 1, - isSummary: true, - height: o.rowSize - }); - top += o.rowSize; - } - } + BI.extend(BI.SliderIconButton.superclass._init.apply(this, arguments)); + this.slider = BI.createWidget({ + type: "bi.icon_button", + cls: "slider-icon slider-button", + iconWidth: 14, + iconHeight: 14, + height: 14, + width: 14 + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.slider, + top: 7, + left: -7 + }], + width: 0, + height: 14 }); - return result; } }); -BI.shortcut('bi.sequence_table_dynamic_number', BI.SequenceTableDynamicNumber);/** - * - * Created by GUY on 2016/5/26. - * @class BI.SequenceTableListNumber - * @extends BI.Widget +BI.shortcut("bi.single_slider_button", BI.SliderIconButton);/** + * Created by zcf on 2016/9/22. */ -BI.SequenceTableListNumber = BI.inherit(BI.Widget, { - +BI.SingleSlider = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 90, + EDITOR_HEIGHT: 30, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, _defaultConfig: function () { - return BI.extend(BI.SequenceTableListNumber.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-sequence-table-list-number", - isNeedFreeze: false, - scrollTop: 0, - startSequence: 1,//开始的序号 - headerRowSize: 25, - rowSize: 25, - - sequenceHeaderCreator: null, - - header: [], - items: [], //二维数组 - - //交叉表头 - crossHeader: [], - crossItems: [], - - pageSize: 20 + return BI.extend(BI.SingleSlider.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-slider bi-slider-track", + digit: false }); }, - _init: function () { - BI.SequenceTableListNumber.superclass._init.apply(this, arguments); + BI.SingleSlider.superclass._init.apply(this, arguments); + var self = this, o = this.options; - this.start = o.startSequence; - this.renderedCells = []; - this.renderedKeys = []; + var c = this._constant; + this.enable = false; + this.value = ""; - this.container = BI.createWidget({ - type: "bi.absolute", - width: 60, - scrollable: false + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 }); - - this.scrollContainer = BI.createWidget({ - type: "bi.vertical", - scrollable: false, - scrolly: false, - items: [this.container] + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 }); + this.track = this._createTrackWrapper(); - this.headerContainer = BI.createWidget({ - type: "bi.absolute", - cls: "bi-border", - width: 58, - scrollable: false + this.slider = BI.createWidget({ + type: "bi.single_slider_button" }); - - this.layout = BI.createWidget({ - type: "bi.vtape", - element: this, + this._draggable(this.slider); + var sliderVertical = BI.createWidget({ + type: "bi.vertical", items: [{ - el: this.headerContainer, - height: o.headerRowSize * o.header.length - 2 - }, { - el: {type: "bi.layout"}, - height: 2 - }, { - el: this.scrollContainer - }] + type: "bi.absolute", + items: [this.slider] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }); + sliderVertical.element.click(function (e) { + if (self.enable) { + var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; + var trackLength = self.track.element[0].scrollWidth; + var percent = 0; + if (offset < 0) { + percent = 0 + } + if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + percent = offset * 100 / self._getGrayTrackLength(); + } + if (offset > (trackLength - c.SLIDER_WIDTH)) { + percent = 100 + } + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + } }); - this._populate(); - }, - - _layout: function () { - var self = this, o = this.options; - var headerHeight = o.headerRowSize * o.header.length - 2; - var items = this.layout.attr("items"); - if (o.isNeedFreeze === false) { - items[0].height = 0; - items[1].height = 0; - } else if (o.isNeedFreeze === true) { - items[0].height = headerHeight; - items[1].height = 2; - } - this.layout.attr("items", items); - this.layout.resize(); - this.container.setHeight(o.items.length * o.rowSize); - try { - this.scrollContainer.element.scrollTop(o.scrollTop); - } catch (e) { - - } - }, - - _createHeader: function () { - var o = this.options; + this.label = BI.createWidget({ + type: "bi.sign_editor", + cls: "slider-editor-button", + errorText: "", + width: c.EDITOR_WIDTH - 2, + allowBlank: false, + validationChecker: function (v) { + return self._checkValidation(v); + }, + quitChecker: function (v) { + return self._checkValidation(v); + } + }); + this.label.element.hover(function () { + self.label.element.removeClass("bi-border").addClass("bi-border"); + }, function () { + self.label.element.removeClass("bi-border"); + }); + this.label.on(BI.SignEditor.EVENT_CONFIRM, function () { + var v = BI.parseFloat(this.getValue()); + var percent = self._getPercentByValue(v); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + this.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + }); + this._setVisible(false); BI.createWidget({ type: "bi.absolute", - element: this.headerContainer, + element: this, items: [{ - el: o.sequenceHeaderCreator || { - type: "bi.table_style_cell", - cls: "sequence-table-title-cell", - styleGetter: o.headerCellStyleGetter, - text: BI.i18nText("BI-Number_Index") + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT }, + top: 23, left: 0, + width: "100%" + }, { + el: sliderVertical, + top: 20, + left: 0, + width: "100%" + }, { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.label] + }], + rgap: c.EDITOR_WIDTH, + height: c.EDITOR_HEIGHT + }, top: 0, - right: 0, - bottom: 0 + left: 0, + width: "100%" }] - }); + }) }, - _calculateChildrenToRender: function () { + _draggable: function (widget) { var self = this, o = this.options; - var scrollTop = BI.clamp(o.scrollTop, 0, o.rowSize * o.items.length - (o.height - o.header.length * o.headerRowSize) + BI.DOM.getScrollWidth()); - var start = Math.floor(scrollTop / o.rowSize); - var end = start + Math.floor((o.height - o.header.length * o.headerRowSize) / o.rowSize); - var renderedCells = [], renderedKeys = []; - for (var i = start, cnt = 0; i <= end && i < o.items.length; i++, cnt++) { - var index = BI.deepIndexOf(this.renderedKeys, this.start + i); - var top = i * o.rowSize; - if (index > -1) { - if (o.rowSize !== this.renderedCells[index]._height) { - this.renderedCells[index]._height = o.rowSize; - this.renderedCells[index].el.setHeight(o.rowSize); - } - if (this.renderedCells[index].top !== top) { - this.renderedCells[index].top = top; - this.renderedCells[index].el.element.css("top", top + "px"); - } - renderedCells.push(this.renderedCells[index]); - } else { - var child = BI.createWidget(BI.extend({ - type: "bi.table_style_cell", - cls: "sequence-table-number-cell bi-border-left bi-border-right bi-border-bottom", - width: 60, - height: o.rowSize, - text: this.start + i, - styleGetter: function (index) { - return function () { - return o.sequenceCellStyleGetter(self.start + i - 1); - } - }(cnt) - })); - renderedCells.push({ - el: child, - left: 0, - top: top, - _height: o.rowSize - }); - } - renderedKeys.push(this.start + i); - } - - //已存在的, 需要添加的和需要删除的 - var existSet = {}, addSet = {}, deleteArray = []; - BI.each(renderedKeys, function (i, key) { - if (BI.deepContains(self.renderedKeys, key)) { - existSet[i] = key; - } else { - addSet[i] = key; - } - }); - BI.each(this.renderedKeys, function (i, key) { - if (BI.deepContains(existSet, key)) { - return; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1));//直接对计算出来的百分数保留到小数点后一位,相当于分成了1000份。 + self._setBlueTrack(significantPercent); + self._setLabelPosition(significantPercent); + self._setSliderPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); } - if (BI.deepContains(addSet, key)) { + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setSliderPosition(significantPercent); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ return; } - deleteArray.push(i); - }); - BI.each(deleteArray, function (i, index) { - self.renderedCells[index].el.destroy(); - }); - var addedItems = []; - BI.each(addSet, function (index) { - addedItems.push(renderedCells[index]) + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); }); - BI.createWidget({ + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createTrackWrapper: function () { + return BI.createWidget({ type: "bi.absolute", - element: this.container, - items: addedItems - }); - this.renderedCells = renderedCells; - this.renderedKeys = renderedKeys; + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }] + }) }, - _populate: function () { - this.headerContainer.empty(); - this._createHeader(); - this._layout(); - this._calculateChildrenToRender(); + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) }, - setVerticalScroll: function (scrollTop) { - if (this.options.scrollTop !== scrollTop) { - this.options.scrollTop = scrollTop; - try { - this.scrollContainer.element.scrollTop(scrollTop); - } catch (e) { + _setBlueTrack: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, - } - } + _setLabelPosition: function (percent) { + this.label.element.css({"left": percent + "%"}); }, - getVerticalScroll: function () { - return this.options.scrollTop; + _setSliderPosition: function (percent) { + this.slider.element.css({"left": percent + "%"}); }, - setVPage: function (v) { - v = v < 1 ? 1 : v; - var o = this.options; - this.start = (v - 1) * o.pageSize + 1; + _setAllPosition: function (percent) { + this._setSliderPosition(percent); + this._setLabelPosition(percent); + this._setBlueTrack(percent); }, - _restore: function () { - var o = this.options; - BI.each(this.renderedCells, function (i, cell) { - cell.el.destroy(); - }); - this.renderedCells = []; - this.renderedKeys = []; + _setVisible: function (visible) { + this.slider.setVisible(visible); + this.label.setVisible(visible); }, - restore: function () { - this._restore(); + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth }, - populate: function (items, header) { + _getValueByPercent: function (percent) { + var thousandth = BI.parseInt(percent * 10); + return (((this.max - this.min) * thousandth) / 1000 + this.min); + }, + + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + getValue: function () { + return this.value; + }, + + setValue: function (v) { var o = this.options; - if (items && items !== this.options.items) { - o.items = items; - this._restore(); + v = BI.parseFloat(v); + v = o.digit === false ? v : v.toFixed(o.digit); + if ((!isNaN(v))) { + if (this._checkValidation(v)) { + this.value = v; + } + if (v > this.max) { + this.value = this.max; + } + if (v < this.min) { + this.value = this.min; + } } - if (header && header !== this.options.header) { - o.header = header; + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + this.min = minNumber; + this.max = maxNumber; + } + }, + + reset: function () { + this._setVisible(false); + this.enable = false; + this.value = ""; + this.min = 0; + this.max = 0; + this._setBlueTrack(0); + + }, + + populate: function () { + if (!isNaN(this.min) && !isNaN(this.max)) { + this._setVisible(true); + this.enable = true; + this.label.setErrorText(BI.i18nText("BI-Please_Enter") + this.min + "-" + this.max + BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Basic_Number")); + if (BI.isNumeric(this.value) || BI.isNotEmptyString(this.value)) { + this.label.setValue(this.value); + this._setAllPosition(this._getPercentByValue(this.value)); + } else { + this.label.setValue(this.max); + this._setAllPosition(100); + } } - this._populate(); } }); -BI.shortcut('bi.sequence_table_list_number', BI.SequenceTableListNumber);/** - * 带有序号的表格 - * - * Created by GUY on 2016/5/26. - * @class BI.SequenceTable - * @extends BI.Widget +BI.SingleSlider.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.single_slider", BI.SingleSlider);/** + * Created by Urthur on 2017/9/12. */ -BI.SequenceTable = BI.inherit(BI.Widget, { - +BI.SingleSliderLabel = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 90, + EDITOR_HEIGHT: 20, + HEIGHT: 20, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, _defaultConfig: function () { - return BI.extend(BI.SequenceTable.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-sequence-table", - el: { - type: "bi.adaptive_table" - }, + return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-slider-label bi-slider-track", + digit: false, + unit: "" + }); + }, + _init: function () { + BI.SingleSliderLabel.superclass._init.apply(this, arguments); - sequence: {}, + var self = this, o = this.options; + var c = this._constant; + this.enable = false; + this.value = ""; - isNeedResize: true, - isResizeAdapt: false, + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + this.track = this._createTrackWrapper(); + + this.slider = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.slider); + var sliderVertical = BI.createWidget({ + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.slider] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }); + sliderVertical.element.click(function (e) { + if (self.enable) { + var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; + var trackLength = self.track.element[0].scrollWidth; + var percent = 0; + if (offset < 0) { + percent = 0 + } + if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + percent = offset * 100 / self._getGrayTrackLength(); + } + if (offset > (trackLength - c.SLIDER_WIDTH)) { + percent = 100 + } + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setText(v + o.unit); + self.value = v; + self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); + } + }); + this.label = BI.createWidget({ + type: "bi.label", + height: c.HEIGHT, + width: c.EDITOR_WIDTH - 2 + }); + + this._setVisible(false); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 13, + left: 0, + width: "100%" + }, { + el: sliderVertical, + top: 10, + left: 0, + width: "100%" + }, { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.label] + }], + rgap: c.EDITOR_WIDTH, + height: c.EDITOR_HEIGHT + }, + top: 0, + left: 0, + width: "100%" + }] + }) + }, + + _draggable: function (widget) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1));//直接对计算出来的百分数保留到小数点后一位,相当于分成了1000份。 + self._setBlueTrack(significantPercent); + self._setLabelPosition(significantPercent); + self._setSliderPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setSliderPosition(significantPercent); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createTrackWrapper: function () { + return BI.createWidget({ + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }] + }) + }, - isNeedFreeze: false,//是否需要冻结单元格 - freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, - isNeedMerge: false,//是否需要合并单元格 - mergeCols: [], //合并的单元格列号 - mergeRule: BI.emptyFn, + _setBlueTrack: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, - columnSize: [], - minColumnSize: [], - maxColumnSize: [], - headerRowSize: 25, - rowSize: 25, + _setLabelPosition: function (percent) { + this.label.element.css({"left": percent + "%"}); + }, - regionColumnSize: [], + _setSliderPosition: function (percent) { + this.slider.element.css({"left": percent + "%"}); + }, - headerCellStyleGetter: BI.emptyFn, - summaryCellStyleGetter: BI.emptyFn, - sequenceCellStyleGetter: BI.emptyFn, + _setAllPosition: function (percent) { + this._setSliderPosition(percent); + this._setLabelPosition(percent); + this._setBlueTrack(percent); + }, - header: [], - items: [], //二维数组 + _setVisible: function (visible) { + this.slider.setVisible(visible); + this.label.setVisible(visible); + }, - //交叉表头 - crossHeader: [], - crossItems: [], + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, - showSequence: false, - startSequence: 1//开始的序号 - }); + _getValueByPercent: function (percent) { + var thousandth = BI.parseInt(percent * 10); + return (((this.max - this.min) * thousandth) / 1000 + this.min); }, - _init: function () { - BI.SequenceTable.superclass._init.apply(this, arguments); - var self = this, o = this.options; + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, - this.sequence = BI.createWidget(o.sequence, { - type: "bi.sequence_table_list_number", - invisible: o.showSequence === false, - startSequence: o.startSequence, - isNeedFreeze: o.isNeedFreeze, - header: o.header, - items: o.items, - crossHeader: o.crossHeader, - crossItems: o.crossItems, - headerRowSize: o.headerRowSize, - rowSize: o.rowSize, - width: 60, - height: o.height && o.height - BI.GridTableScrollbar.SIZE, + getValue: function () { + return this.value; + }, - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter - }); - this.table = BI.createWidget(o.el, { - type: "bi.adaptive_table", - width: o.showSequence === true ? o.width - 60 : o.width, - height: o.height, - isNeedResize: o.isNeedResize, - isResizeAdapt: o.isResizeAdapt, + setValue: function (v) { + var o = this.options; + v = BI.parseFloat(v); + v = o.digit === false ? v : v.toFixed(o.digit); + if ((!isNaN(v))) { + if (this._checkValidation(v)) { + this.value = v; + } + if (v > this.max) { + this.value = this.max; + } + if (v < this.min) { + this.value = this.min; + } + } + }, - isNeedFreeze: o.isNeedFreeze, - freezeCols: o.freezeCols, + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + this.min = minNumber; + this.max = maxNumber; + } + }, - isNeedMerge: o.isNeedMerge, - mergeCols: o.mergeCols, - mergeRule: o.mergeRule, + reset: function () { + this._setVisible(false); + this.enable = false; + this.value = ""; + this.min = 0; + this.max = 0; + this._setBlueTrack(0); + }, - columnSize: o.columnSize, - minColumnSize: o.minColumnSize, - maxColumnSize: o.maxColumnSize, - headerRowSize: o.headerRowSize, - rowSize: o.rowSize, + populate: function () { + var o = this.options; + if (!isNaN(this.min) && !isNaN(this.max)) { + this._setVisible(true); + this.enable = true; + if (BI.isNumeric(this.value) || BI.isNotEmptyString(this.value)) { + this.label.setValue(this.value + o.unit); + this._setAllPosition(this._getPercentByValue(this.value)); + } else { + this.label.setValue(this.max + o.unit); + this._setAllPosition(100); + } + } + } +}); +BI.SingleSliderLabel.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.single_slider_label", BI.SingleSliderLabel);/** + * normal single slider + * Created by Young on 2017/6/21. + */ +BI.SingleSliderNormal = BI.inherit(BI.Widget, { - regionColumnSize: o.regionColumnSize, + _constant: { + HEIGHT: 28, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter, + props: { + baseCls: "bi-single-slider-normal bi-slider-track", + minMax: { + min: 0, + max: 100 + }, + // color: "#3f8ce8" + }, - header: o.header, - items: o.items, - //交叉表头 - crossHeader: o.crossHeader, - crossItems: o.crossItems + render: function () { + var self = this; + var c = this._constant; + var track = this._createTrack(); + this.slider = BI.createWidget({ + type: "bi.single_slider_button" }); + this._draggable(this.slider); - this.table.on(BI.Table.EVENT_TABLE_SCROLL, function (scroll) { - if (self.sequence.getVerticalScroll() !== this.getVerticalScroll()) { - self.sequence.setVerticalScroll(this.getVerticalScroll()); - self.sequence.populate(); + var sliderVertical = BI.createWidget({ + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.slider] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }); + sliderVertical.element.click(function (e) { + if (self.enable) { + var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; + var trackLength = self.track.element[0].scrollWidth; + var percent = 0; + if (offset < 0) { + percent = 0 + } + if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + percent = offset * 100 / self._getGrayTrackLength(); + } + if (offset > (trackLength - c.SLIDER_WIDTH)) { + percent = 100 + } + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); } - self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { - o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); - }); - this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { - o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); - self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); }); - this.htape = BI.createWidget({ + return { type: "bi.absolute", element: this, items: [{ - el: this.sequence, + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 3, left: 0, - top: 0 + width: "100%" }, { - el: this.table, + el: sliderVertical, top: 0, - left: o.showSequence === true ? 60 : 0 + left: 0, + width: "100%" }] - }); - this._populate(); - }, - - _populate: function () { - var o = this.options; - if (o.showSequence === true) { - this.sequence.setVisible(true); - this.table.element.css("left", "60px"); - this.table.setWidth(o.width - 60); - } else { - this.sequence.setVisible(false); - this.table.element.css("left", "0px"); - this.table.setWidth(o.width); } }, - setWidth: function (width) { - BI.PageTable.superclass.setWidth.apply(this, arguments); - this.table.setWidth(this.options.showSequence ? width - 60 : width); - }, + _draggable: function (widget) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1));//直接对计算出来的百分数保留到小数点后一位,相当于分成了1000份。 + self._setBlueTrack(significantPercent); + self._setSliderPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.value = v; + self.fireEvent(BI.SingleSliderNormal.EVENT_DRAG, v); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setSliderPosition(significantPercent); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); - setHeight: function (height) { - BI.PageTable.superclass.setHeight.apply(this, arguments); - this.table.setHeight(height); - this.sequence.setHeight(height - BI.GridTableScrollbar.SIZE); + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } }, - setColumnSize: function (columnSize) { - this.options.columnSize = columnSize; - this.table.setColumnSize(columnSize); - }, + _createTrack: function () { + var self = this; + var c = this._constant; + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + if (this.options.color) { + this.blueTrack.element.css({"background-color": this.options.color}); + } - getColumnSize: function () { - return this.table.getColumnSize(); + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }], + ref: function (ref) { + self.track = ref; + } + } }, - setRegionColumnSize: function (columnSize) { - this.options.columnSize = columnSize; - this.table.setRegionColumnSize(columnSize); + _checkValidation: function (v) { + return !(BI.isNull(v) || v < this.min || v > this.max) }, - getRegionColumnSize: function () { - return this.table.getRegionColumnSize(); + _setBlueTrack: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); }, - hasLeftHorizontalScroll: function () { - return this.table.hasLeftHorizontalScroll(); + _setSliderPosition: function (percent) { + this.slider.element.css({"left": percent + "%"}); }, - hasRightHorizontalScroll: function () { - return this.table.hasRightHorizontalScroll(); + _setAllPosition: function (percent) { + this._setSliderPosition(percent); + this._setBlueTrack(percent); }, - setLeftHorizontalScroll: function (scrollLeft) { - this.table.setLeftHorizontalScroll(scrollLeft); + _setVisible: function (visible) { + this.slider.setVisible(visible); }, - setRightHorizontalScroll: function (scrollLeft) { - this.table.setRightHorizontalScroll(scrollLeft); + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth }, - setVerticalScroll: function (scrollTop) { - this.table.setVerticalScroll(scrollTop); - this.sequence.setVerticalScroll(scrollTop); + _getValueByPercent: function (percent) { + var thousandth = BI.parseInt(percent * 10); + return (((this.max - this.min) * thousandth) / 1000 + this.min); }, - getVerticalScroll: function () { - return this.table.getVerticalScroll(); + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); }, - setVPage: function (page) { - this.sequence.setVPage && this.sequence.setVPage(page); + getValue: function () { + return this.value; }, - setHPage: function (page) { - this.sequence.setHPage && this.sequence.setHPage(page); + setValue: function (v) { + var value = BI.parseFloat(v); + if ((!isNaN(value))) { + if (this._checkValidation(value)) { + this.value = value; + } + if (value > this.max) { + this.value = this.max; + } + if (value < this.min) { + this.value = this.min; + } + } }, - attr: function () { - BI.SequenceTable.superclass.attr.apply(this, arguments); - this.table.attr.apply(this.table, arguments); - this.sequence.attr.apply(this.sequence, arguments); + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + this.min = minNumber; + this.max = maxNumber; + } }, - restore: function () { - this.table.restore(); - this.sequence.restore(); + reset: function () { + this._setVisible(false); + this.enable = false; + this.value = ""; + this.min = 0; + this.max = 0; + this._setBlueTrack(0); }, - populate: function (items, header, crossItems, crossHeader) { - var o = this.options; - if (items) { - o.items = items; - } - if (header) { - o.header = header; - } - if (crossItems) { - o.crossItems = crossItems; - } - if (crossHeader) { - o.crossHeader = crossHeader; + populate: function () { + if (!isNaN(this.min) && !isNaN(this.max)) { + this._setVisible(true); + this.enable = true; + if (BI.isNumeric(this.value) || BI.isNotEmptyString(this.value)) { + this._setAllPosition(this._getPercentByValue(this.value)); + } else { + this._setAllPosition(100); + } } - this._populate(); - this.table.populate.apply(this.table, arguments); - this.sequence.populate.apply(this.sequence, arguments); - this.sequence.setVerticalScroll(this.table.getVerticalScroll()); - }, - - destroy: function () { - this.table.destroy(); - BI.SequenceTable.superclass.destroy.apply(this, arguments); } }); -BI.shortcut('bi.sequence_table', BI.SequenceTable);/** +BI.SingleSliderNormal.EVENT_DRAG = "EVENT_DRAG"; +BI.shortcut("bi.single_slider_normal", BI.SingleSliderNormal);/** * @class BI.SingleTreeCombo * @extends BI.Widget */ diff --git a/demo/js/config/addons.js b/demo/js/config/addons.js index 827102bb2..45e70d5ad 100644 --- a/demo/js/config/addons.js +++ b/demo/js/config/addons.js @@ -9,9 +9,4 @@ Demo.ADDONS_CONFIG = [{ pId: 1001, text: "柱状图", value: "demo.axis_chart" -}, { - pId: 1000, - id: 1002, - text: "滚动sliders", - value: "demo.slider" }]; \ No newline at end of file diff --git a/demo/js/config/fix.js b/demo/js/config/fix.js index 36cefac0d..f9645572e 100644 --- a/demo/js/config/fix.js +++ b/demo/js/config/fix.js @@ -113,4 +113,9 @@ Demo.FIX_CONFIG = [{ pId: 7, text: "一个混合的例子", value: "demo.fix" +}, { + id: 77, + pId: 7, + text: "场景", + value: "demo.fix_scene" }]; \ No newline at end of file diff --git a/demo/js/config/widget.js b/demo/js/config/widget.js index 30655afa5..31df14876 100644 --- a/demo/js/config/widget.js +++ b/demo/js/config/widget.js @@ -234,4 +234,8 @@ Demo.WIDGET_CONFIG = [{ pId: 419, text: "bi.file_manager", value: "demo.file_manager" +}, { + id: 420, + text: "滚动sliders", + value: "demo.slider" }]; \ No newline at end of file diff --git a/demo/js/fix-2.0/scene.js b/demo/js/fix-2.0/scene.js new file mode 100644 index 000000000..a52e809d4 --- /dev/null +++ b/demo/js/fix-2.0/scene.js @@ -0,0 +1,444 @@ +/** + * @Author: Young + * @CreationDate 2017-11-06 10:32 + * @Description + */ +;(function () { + var model = Fix.define({ + groups: [{ + id: "27a9c8bf159e99e", + name: "功能数据", + packages: [{ + id: "82a96a4b03ac17e6", + name: "通信行业", + type: 1, + tables: [{ + id: "品类", + name: "品类", + connName: "BIDemo", + fields: [{ + id: "sd2ad2f343ca23", + name: "类别", + type: 32, + enable: true, + usable: true + }, { + id: "f34ds34aw2345w", + name: "描述", + type: 32, + enable: true, + usable: true + }] + }] + }] + }, { + id: "das2dw24214sa4", + name: "样式数据", + packages: [{ + id: "hi23i1o34a34we", + name: "零售行业", + type: 1, + tables: [{ + id: "销售记录", + name: "销售记录", + connName: "BIDemo", + fields: [{ + id: "wr213d24t345", + name: "分类", + type: 16, + enable: true, + usable: true + }, { + id: "faw134r24al344", + name: "金额", + type: 32, + enable: true, + usable: true + }] + }] + }, { + id: "fwr124f3453fa", + name: "地产行业", + tables: [{ + id: "开发商名称", + name: "开发商名称", + connName: "BIDemo", + fields: [{ + id: "sa13f345fg356", + name: "编号", + type: 32, + enable: true, + usable: true + }, { + id: "ad2r24tt232a22", + name: "名称", + type: 16, + enable: true, + usable: true + }] + }, { + id: "楼盘", + name: "楼盘", + connName: "BIDemo", + fields: [{ + id: "hfe3345fg356", + name: "编号", + type: 32, + enable: true, + usable: true + }, { + id: "kl224tt232a22", + name: "名称", + type: 16, + enable: true, + usable: true + }] + }] + }] + }], + fineIndexUpdate: { + needUpdate: false, + lastUpdate: 1509953199062 + } + }); + + Demo.FixScene = BI.inherit(BI.Widget, { + constant: { + TAB1: 1, + TAB2: 2 + }, + + _store: function () { + return model; + }, + + watch: { + "groups.*.name": function () { + this.fineIndexTab.setText("FineIndex更新(******* 分组名变化 需要更新 *******)"); + this.model.fineIndexUpdate.needUpdate = true; + }, + "groups.*.packages.*.name": function () { + this.fineIndexTab.setText("FineIndex更新(******* 业务包名变化 需要更新 *******)"); + this.model.fineIndexUpdate.needUpdate = true; + }, + "groups.*.packages.*.tables.*.name": function () { + this.fineIndexTab.setText("FineIndex更新(******* 表名变化 需要更新 *******)"); + this.model.fineIndexUpdate.needUpdate = true; + }, + "groups.*.packages.*.tables.*.fields.*.name": function () { + this.fineIndexTab.setText("FineIndex更新(******* 字段名变化 需要更新 *******)"); + this.model.fineIndexUpdate.needUpdate = true; + }, + "fineIndexUpdate.needUpdate": function (needUpdate) { + !needUpdate && this.fineIndexTab.setText("FineIndex更新"); + } + }, + + render: function () { + var self = this; + return { + type: "bi.tab", + defaultShowIndex: this.constant.TAB1, + tab: { + type: "bi.button_group", + items: BI.createItems([{ + text: "业务包管理", + value: this.constant.TAB1 + }, { + text: "FineIndex更新", + value: this.constant.TAB2, + ref: function (ref) { + self.fineIndexTab = ref; + } + }], { + type: "bi.text_button", + cls: "bi-list-item-active", + height: 50 + }), + height: 50 + }, + cardCreator: BI.bind(this.cardCreator, this) + } + }, + + cardCreator: function (v) { + switch (v) { + case this.constant.TAB1: + return { + type: "demo.fix_scene_data_manager", + data: this.model + }; + case this.constant.TAB2: + return { + type: "demo.fix_scene_fine_index_update" + } + } + } + }); + BI.shortcut("demo.fix_scene", Demo.FixScene); + + Demo.FixSceneDataManager = BI.inherit(BI.Widget, { + _store: function () { + return this.options.data; + }, + + watch: { + "*.name": function () { + + } + }, + + render: function () { + var items = []; + BI.each(this.model.groups, function (i, group) { + items.push({ + type: "demo.fix_scene_group", + group: group + }); + }); + + return { + type: "bi.vertical", + items: [{ + type: "bi.left", + items: BI.createItems([{ + text: "分组名" + }, { + text: "业务包名" + }, { + text: "表名" + }, { + text: "字段名" + }], { + type: "bi.label", + cls: "layout-bg1", + width: 150 + }), + + }, { + type: "bi.vertical", + items: items + }], + vgap: 20, + hgap: 20 + } + } + + }); + BI.shortcut("demo.fix_scene_data_manager", Demo.FixSceneDataManager); + + Demo.FixSceneGroup = BI.inherit(BI.Widget, { + props: { + group: {} + }, + + _store: function () { + return this.options.group; + }, + + render: function () { + var self = this; + var items = []; + BI.each(this.model.packages, function (i, child) { + items.push({ + type: "demo.fix_scene_package", + pack: child + }); + }); + return { + type: "bi.left", + items: [{ + type: "bi.sign_editor", + cls: "bi-border-bottom", + width: 100, + height: 30, + value: this.model.name, + listeners: [{ + eventName: BI.SignEditor.EVENT_CHANGE, + action: function () { + self.model.name = this.getValue(); + } + }] + }, { + type: "bi.vertical", + items: items + }], + hgap: 20 + } + } + }); + BI.shortcut("demo.fix_scene_group", Demo.FixSceneGroup); + + + Demo.FixScenePackage = BI.inherit(BI.Widget, { + props: { + pack: {} + }, + + _store: function () { + return this.options.pack; + }, + + render: function () { + var self = this; + var items = []; + BI.each(this.model.tables, function (i, child) { + items.push({ + type: "demo.fix_scene_table", + table: child + }) + }); + return { + type: "bi.left", + items: [{ + type: "bi.sign_editor", + cls: "bi-border-bottom", + width: 100, + height: 30, + value: this.model.name, + listeners: [{ + eventName: BI.SignEditor.EVENT_CHANGE, + action: function () { + self.model.name = this.getValue(); + } + }] + }, { + type: "bi.vertical", + items: items + }], + hgap: 20 + } + } + }); + BI.shortcut("demo.fix_scene_package", Demo.FixScenePackage); + + Demo.FixSceneTable = BI.inherit(BI.Widget, { + props: { + table: {} + }, + + _store: function () { + return this.options.table; + }, + + render: function () { + var self = this; + var items = []; + BI.each(this.model.fields, function (i, child) { + items.push({ + type: "demo.fix_scene_field", + field: child + }); + }); + return { + type: "bi.left", + items: [{ + type: "bi.sign_editor", + cls: "bi-border-bottom", + width: 100, + height: 30, + value: this.model.name, + listeners: [{ + eventName: BI.SignEditor.EVENT_CHANGE, + action: function () { + self.model.name = this.getValue(); + } + }] + }, { + type: "bi.vertical", + items: items + }], + hgap: 20 + } + } + }); + BI.shortcut("demo.fix_scene_table", Demo.FixSceneTable); + + Demo.FixSceneField = BI.inherit(BI.Widget, { + props: { + field: {} + }, + + _store: function () { + return this.options.field; + }, + + render: function () { + var self = this; + return { + type: "bi.center_adapt", + items: [{ + type: "bi.sign_editor", + cls: "bi-border-bottom", + width: 100, + height: 30, + value: this.model.name, + listeners: [{ + eventName: BI.SignEditor.EVENT_CHANGE, + action: function () { + self.model.name = this.getValue(); + } + }] + }] + } + } + }); + BI.shortcut("demo.fix_scene_field", Demo.FixSceneField); + + Demo.FixSceneFineIndexUpdateStore = BI.inherit(Fix.VM, { + _init: function () { + this.fineIndexUpdate = model.fineIndexUpdate; + }, + computed: { + text: function () { + return "立即更新(上次更新时间:" + BI.date2Str(new Date(this.fineIndexUpdate.lastUpdate), "yyyy-MM-dd HH:mm:ss") + ")"; + }, + needUpdate: function () { + return this.fineIndexUpdate.needUpdate; + } + }, + actions: { + updateFineIndex: function () { + this.fineIndexUpdate.needUpdate = false; + this.fineIndexUpdate.lastUpdate = new Date().getTime(); + } + } + }); + + Demo.FixSceneFineIndexUpdate = BI.inherit(BI.Widget, { + _store: function () { + return new Demo.FixSceneFineIndexUpdateStore(); + }, + + watch: { + "needUpdate": function () { + this.button.setEnable(this.model.needUpdate) + }, + "text": function () { + this.button.setText(this.model.text); + } + }, + + render: function () { + var self = this; + return { + type: "bi.center_adapt", + items: [{ + type: "bi.button", + text: this.model.text, + disabled: !this.model.needUpdate, + height: 30, + width: 360, + handler: function () { + self.store.updateFineIndex(); + }, + ref: function (ref) { + self.button = ref; + } + }] + } + } + }); + BI.shortcut("demo.fix_scene_fine_index_update", Demo.FixSceneFineIndexUpdate); + +})(); \ No newline at end of file diff --git a/demo/js/addons/slider/demo.slider.js b/demo/js/widget/slider/demo.slider.js similarity index 100% rename from demo/js/addons/slider/demo.slider.js rename to demo/js/widget/slider/demo.slider.js diff --git a/dist/base.js b/dist/base.js index 1c179e02d..385dfc7ec 100644 --- a/dist/base.js +++ b/dist/base.js @@ -16270,68 +16270,68 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { key: function (e) { } -});/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorTextToolbar - * @extends BI.Widget - */ -BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-rich-editor-text-toolbar bi-background", - buttons: [ - {type: "bi.rich_editor_size_chooser"}, - {type: "bi.rich_editor_bold_button"}, - {type: "bi.rich_editor_italic_button"}, - {type: "bi.rich_editor_underline_button"}, - {type: "bi.rich_editor_color_chooser"}, - {type: "bi.rich_editor_background_color_chooser"}, - {type: "bi.rich_editor_align_left_button"}, - {type: "bi.rich_editor_align_center_button"}, - {type: "bi.rich_editor_align_right_button"}, - {type: "bi.rich_editor_param_button"}, - ], - height: 28 - }); - }, - - _init: function () { - BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); - var self = this, o = this.options; - BI.createWidget({ - type: "bi.left", - element: this, - items: BI.map(o.buttons, function (i, btn) { - return BI.extend(btn, { - editor: o.editor - }); - }), - hgap: 3, - vgap: 3 - }) - }, - - mounted: function () { - var self = this; - if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 - this.element.mousedown(function () { - self._noSelect(self.element[0]); - }); - this._noSelect(this.element[0]); - } - }, - - _noSelect: function (element) { - if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { - element.setAttribute('unselectable', 'on'); - } - for (var i = 0; i < element.childNodes.length; i++) { - this._noSelect(element.childNodes[i]); - } - } -}); +});/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorTextToolbar + * @extends BI.Widget + */ +BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-text-toolbar bi-background", + buttons: [ + {type: "bi.rich_editor_size_chooser"}, + {type: "bi.rich_editor_bold_button"}, + {type: "bi.rich_editor_italic_button"}, + {type: "bi.rich_editor_underline_button"}, + {type: "bi.rich_editor_color_chooser"}, + {type: "bi.rich_editor_background_color_chooser"}, + {type: "bi.rich_editor_align_left_button"}, + {type: "bi.rich_editor_align_center_button"}, + {type: "bi.rich_editor_align_right_button"}, + {type: "bi.rich_editor_param_button"}, + ], + height: 28 + }); + }, + + _init: function () { + BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + BI.createWidget({ + type: "bi.left", + element: this, + items: BI.map(o.buttons, function (i, btn) { + return BI.extend(btn, { + editor: o.editor + }); + }), + hgap: 3, + vgap: 3 + }) + }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } +}); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** * 富文本编辑器 * @@ -16612,57 +16612,57 @@ BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** } }); }()); -/** - * 颜色选择trigger - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorBackgroundChooserTrigger - * @extends BI.Widget - */ -BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - width: 20, - height: 20 - }); - }, - - _init: function () { - BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); - this.font = BI.createWidget({ - type: "bi.icon_button", - cls: "text-background-font" - }); - - this.underline = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-underline-font" - }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.font, - top: 2, - left: 2 - }, { - el: this.underline, - top: 7, - left: 2 - }] - }) - }, - - setValue: function (color) { - this.underline.element.css("color", color); - }, - - getValue: function () { - return this.font.element.css("color"); - } -}); +/** + * 颜色选择trigger + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorBackgroundChooserTrigger + * @extends BI.Widget + */ +BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + width: 20, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); + this.font = BI.createWidget({ + type: "bi.icon_button", + cls: "text-background-font" + }); + + this.underline = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-underline-font" + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.font, + top: 2, + left: 2 + }, { + el: this.underline, + top: 7, + left: 2 + }] + }) + }, + + setValue: function (color) { + this.underline.element.css("color", color); + }, + + getValue: function () { + return this.font.element.css("color"); + } +}); BI.shortcut('bi.rich_editor_background_color_chooser_trigger', BI.RichEditorBackgroundChooserTrigger);/** * * Created by GUY on 2015/11/26. @@ -16930,214 +16930,214 @@ BI.RichEditorUnderlineButton = BI.inherit(BI.RichEditorAction, { this.underline.setSelected(false); }, }); -BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton)/** - * 颜色选择trigger - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorColorChooserTrigger - * @extends BI.Widget - */ -BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - width: 20, - height: 20 - }); - }, - - _init: function () { - BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); - this.font = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-font" - }); - - this.underline = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-underline-font" - }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.font, - top: 2, - left: 2 - }, { - el: this.underline, - top: 7, - left: 2 - }] - }) - }, - - setValue: function (color) { - this.underline.element.css("color", color); - }, - - getValue: function () { - return this.font.element.css("color"); - } -}); -BI.shortcut('bi.rich_editor_color_chooser_trigger', BI.RichEditorColorChooserTrigger);/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorBackgroundColorChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { - width: 20, - height: 20, - }); - }, - - _init: function () { - BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.colorchooser = BI.createWidget({ - type: "bi.color_chooser", - element: this, - width: o.width, - height: o.height, - el: { - type: "bi.rich_editor_background_color_chooser_trigger", - title: BI.i18nText("BI-Widget_Background_Colour"), - cls: "text-toolbar-button" - } - }); - this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { - var backgroundColor = this.getValue(); - o.editor.element.css({ - backgroundColor: backgroundColor, - color: BI.DOM.getContrastColor(backgroundColor) - }); - this.setValue(""); - }); - }, - - deactivate: function () { - } -}); -BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorColorChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { - width: 20, - height: 20, - command: "foreColor" - }); - }, - - _init: function () { - BI.RichEditorColorChooser.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.colorchooser = BI.createWidget({ - type: "bi.color_chooser", - element: this, - width: o.width, - height: o.height, - el: { - type: "bi.rich_editor_color_chooser_trigger", - title: BI.i18nText("BI-Font_Colour"), - cls: "text-toolbar-button" - } - }); - this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { - self.doCommand(this.getValue()); - }); - - }, - - deactivate: function () { - this.colorchooser.setValue(""); - } -}); -BI.shortcut('bi.rich_editor_color_chooser', BI.RichEditorColorChooser);/** - * 字体大小选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorSizeChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-rich-editor-size-chooser bi-border bi-card", - command: "FontSize", - width: 50, - height: 20 - }); - }, - - _items: [{ - value: 1, - text: "1(8pt)" - }, { - value: 2, - text: "2(10pt)" - }, { - value: 3, - text: "3(12pt)" - }, { - value: 4, - text: "4(14pt)" - }, { - value: 5, - text: "5(18pt)" - }, { - value: 6, - text: "6(24pt)" - }], - - _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_Size") - }); - - 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(this._items, { - 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([]); - }) - } -}); +BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton)/** + * 颜色选择trigger + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorColorChooserTrigger + * @extends BI.Widget + */ +BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + width: 20, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); + this.font = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-font" + }); + + this.underline = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-underline-font" + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.font, + top: 2, + left: 2 + }, { + el: this.underline, + top: 7, + left: 2 + }] + }) + }, + + setValue: function (color) { + this.underline.element.css("color", color); + }, + + getValue: function () { + return this.font.element.css("color"); + } +}); +BI.shortcut('bi.rich_editor_color_chooser_trigger', BI.RichEditorColorChooserTrigger);/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorBackgroundColorChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { + width: 20, + height: 20, + }); + }, + + _init: function () { + BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorchooser = BI.createWidget({ + type: "bi.color_chooser", + element: this, + width: o.width, + height: o.height, + el: { + type: "bi.rich_editor_background_color_chooser_trigger", + title: BI.i18nText("BI-Widget_Background_Colour"), + cls: "text-toolbar-button" + } + }); + this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { + var backgroundColor = this.getValue(); + o.editor.element.css({ + backgroundColor: backgroundColor, + color: BI.DOM.getContrastColor(backgroundColor) + }); + this.setValue(""); + }); + }, + + deactivate: function () { + } +}); +BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorColorChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { + width: 20, + height: 20, + command: "foreColor" + }); + }, + + _init: function () { + BI.RichEditorColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorchooser = BI.createWidget({ + type: "bi.color_chooser", + element: this, + width: o.width, + height: o.height, + el: { + type: "bi.rich_editor_color_chooser_trigger", + title: BI.i18nText("BI-Font_Colour"), + cls: "text-toolbar-button" + } + }); + this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { + self.doCommand(this.getValue()); + }); + + }, + + deactivate: function () { + this.colorchooser.setValue(""); + } +}); +BI.shortcut('bi.rich_editor_color_chooser', BI.RichEditorColorChooser);/** + * 字体大小选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorSizeChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-size-chooser bi-border bi-card", + command: "FontSize", + width: 50, + height: 20 + }); + }, + + _items: [{ + value: 1, + text: "1(8pt)" + }, { + value: 2, + text: "2(10pt)" + }, { + value: 3, + text: "3(12pt)" + }, { + value: 4, + text: "4(14pt)" + }, { + value: 5, + text: "5(18pt)" + }, { + value: 6, + text: "6(24pt)" + }], + + _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_Size") + }); + + 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(this._items, { + 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([]); + }) + } +}); BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** * 富文本编辑器 * @@ -32411,7 +32411,7 @@ BI.Table = BI.inherit(BI.Widget, { }, mounted: function () { - this._resize(); + this._resize && this._resize(); this.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT); }, @@ -32756,9 +32756,7 @@ BI.Table = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.Table.superclass._init.apply(this, arguments); - + render: function () { this.populate(this.options.items); }, diff --git a/dist/bundle.css b/dist/bundle.css index dd9f8fdde..79076aa31 100644 --- a/dist/bundle.css +++ b/dist/bundle.css @@ -3237,6 +3237,12 @@ ul.ztree.zTreeDragUL { .bi-interactive-arrangement .interactive-arrangement-dragtag-icon { z-index: 1000000000; } +.bi-interval-slider { + min-height: 70px; +} +.bi-interval-slider-label { + min-height: 50px; +} .bi-month-trigger { -webkit-border-radius: 2px; -moz-border-radius: 2px; @@ -3469,6 +3475,36 @@ ul.ztree.zTreeDragUL { box-sizing: border-box; /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ } +.bi-single-slider-label { + min-height: 50px; +} +.bi-single-slider-normal { + min-height: 30px; +} +.bi-single-slider { + min-height: 50px; +} +.bi-single-slider-button .slider-button { + cursor: ew-resize; + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + border-radius: 7px; +} +.bi-slider-track .gray-track { + background-color: rgba(153, 153, 153, 0.3); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d999999,endColorstr=#4d999999); + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.bi-slider-track .blue-track { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} .bi-param-time-interval.time-error .bi-input { color: #e85050; } diff --git a/dist/bundle.js b/dist/bundle.js index 7ab731076..ce1031bf3 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -42011,68 +42011,68 @@ BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { key: function (e) { } -});/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorTextToolbar - * @extends BI.Widget - */ -BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-rich-editor-text-toolbar bi-background", - buttons: [ - {type: "bi.rich_editor_size_chooser"}, - {type: "bi.rich_editor_bold_button"}, - {type: "bi.rich_editor_italic_button"}, - {type: "bi.rich_editor_underline_button"}, - {type: "bi.rich_editor_color_chooser"}, - {type: "bi.rich_editor_background_color_chooser"}, - {type: "bi.rich_editor_align_left_button"}, - {type: "bi.rich_editor_align_center_button"}, - {type: "bi.rich_editor_align_right_button"}, - {type: "bi.rich_editor_param_button"}, - ], - height: 28 - }); - }, - - _init: function () { - BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); - var self = this, o = this.options; - BI.createWidget({ - type: "bi.left", - element: this, - items: BI.map(o.buttons, function (i, btn) { - return BI.extend(btn, { - editor: o.editor - }); - }), - hgap: 3, - vgap: 3 - }) - }, - - mounted: function () { - var self = this; - if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 - this.element.mousedown(function () { - self._noSelect(self.element[0]); - }); - this._noSelect(this.element[0]); - } - }, - - _noSelect: function (element) { - if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { - element.setAttribute('unselectable', 'on'); - } - for (var i = 0; i < element.childNodes.length; i++) { - this._noSelect(element.childNodes[i]); - } - } -}); +});/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorTextToolbar + * @extends BI.Widget + */ +BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-text-toolbar bi-background", + buttons: [ + {type: "bi.rich_editor_size_chooser"}, + {type: "bi.rich_editor_bold_button"}, + {type: "bi.rich_editor_italic_button"}, + {type: "bi.rich_editor_underline_button"}, + {type: "bi.rich_editor_color_chooser"}, + {type: "bi.rich_editor_background_color_chooser"}, + {type: "bi.rich_editor_align_left_button"}, + {type: "bi.rich_editor_align_center_button"}, + {type: "bi.rich_editor_align_right_button"}, + {type: "bi.rich_editor_param_button"}, + ], + height: 28 + }); + }, + + _init: function () { + BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + BI.createWidget({ + type: "bi.left", + element: this, + items: BI.map(o.buttons, function (i, btn) { + return BI.extend(btn, { + editor: o.editor + }); + }), + hgap: 3, + vgap: 3 + }) + }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } +}); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** * 富文本编辑器 * @@ -42353,57 +42353,57 @@ BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** } }); }()); -/** - * 颜色选择trigger - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorBackgroundChooserTrigger - * @extends BI.Widget - */ -BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - width: 20, - height: 20 - }); - }, - - _init: function () { - BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); - this.font = BI.createWidget({ - type: "bi.icon_button", - cls: "text-background-font" - }); - - this.underline = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-underline-font" - }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.font, - top: 2, - left: 2 - }, { - el: this.underline, - top: 7, - left: 2 - }] - }) - }, - - setValue: function (color) { - this.underline.element.css("color", color); - }, - - getValue: function () { - return this.font.element.css("color"); - } -}); +/** + * 颜色选择trigger + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorBackgroundChooserTrigger + * @extends BI.Widget + */ +BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + width: 20, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); + this.font = BI.createWidget({ + type: "bi.icon_button", + cls: "text-background-font" + }); + + this.underline = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-underline-font" + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.font, + top: 2, + left: 2 + }, { + el: this.underline, + top: 7, + left: 2 + }] + }) + }, + + setValue: function (color) { + this.underline.element.css("color", color); + }, + + getValue: function () { + return this.font.element.css("color"); + } +}); BI.shortcut('bi.rich_editor_background_color_chooser_trigger', BI.RichEditorBackgroundChooserTrigger);/** * * Created by GUY on 2015/11/26. @@ -42671,214 +42671,214 @@ BI.RichEditorUnderlineButton = BI.inherit(BI.RichEditorAction, { this.underline.setSelected(false); }, }); -BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton)/** - * 颜色选择trigger - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorColorChooserTrigger - * @extends BI.Widget - */ -BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { - _defaultConfig: function () { - var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - width: 20, - height: 20 - }); - }, - - _init: function () { - BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); - this.font = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-font" - }); - - this.underline = BI.createWidget({ - type: "bi.icon_button", - cls: "text-color-underline-font" - }); - - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.font, - top: 2, - left: 2 - }, { - el: this.underline, - top: 7, - left: 2 - }] - }) - }, - - setValue: function (color) { - this.underline.element.css("color", color); - }, - - getValue: function () { - return this.font.element.css("color"); - } -}); -BI.shortcut('bi.rich_editor_color_chooser_trigger', BI.RichEditorColorChooserTrigger);/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorBackgroundColorChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { - width: 20, - height: 20, - }); - }, - - _init: function () { - BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.colorchooser = BI.createWidget({ - type: "bi.color_chooser", - element: this, - width: o.width, - height: o.height, - el: { - type: "bi.rich_editor_background_color_chooser_trigger", - title: BI.i18nText("BI-Widget_Background_Colour"), - cls: "text-toolbar-button" - } - }); - this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { - var backgroundColor = this.getValue(); - o.editor.element.css({ - backgroundColor: backgroundColor, - color: BI.DOM.getContrastColor(backgroundColor) - }); - this.setValue(""); - }); - }, - - deactivate: function () { - } -}); -BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** - * 颜色选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorColorChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { - width: 20, - height: 20, - command: "foreColor" - }); - }, - - _init: function () { - BI.RichEditorColorChooser.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.colorchooser = BI.createWidget({ - type: "bi.color_chooser", - element: this, - width: o.width, - height: o.height, - el: { - type: "bi.rich_editor_color_chooser_trigger", - title: BI.i18nText("BI-Font_Colour"), - cls: "text-toolbar-button" - } - }); - this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { - self.doCommand(this.getValue()); - }); - - }, - - deactivate: function () { - this.colorchooser.setValue(""); - } -}); -BI.shortcut('bi.rich_editor_color_chooser', BI.RichEditorColorChooser);/** - * 字体大小选择 - * - * Created by GUY on 2015/11/26. - * @class BI.RichEditorSizeChooser - * @extends BI.RichEditorAction - */ -BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { - _defaultConfig: function () { - return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-rich-editor-size-chooser bi-border bi-card", - command: "FontSize", - width: 50, - height: 20 - }); - }, - - _items: [{ - value: 1, - text: "1(8pt)" - }, { - value: 2, - text: "2(10pt)" - }, { - value: 3, - text: "3(12pt)" - }, { - value: 4, - text: "4(14pt)" - }, { - value: 5, - text: "5(18pt)" - }, { - value: 6, - text: "6(24pt)" - }], - - _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_Size") - }); - - 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(this._items, { - 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([]); - }) - } -}); +BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton)/** + * 颜色选择trigger + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorColorChooserTrigger + * @extends BI.Widget + */ +BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + width: 20, + height: 20 + }); + }, + + _init: function () { + BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); + this.font = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-font" + }); + + this.underline = BI.createWidget({ + type: "bi.icon_button", + cls: "text-color-underline-font" + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.font, + top: 2, + left: 2 + }, { + el: this.underline, + top: 7, + left: 2 + }] + }) + }, + + setValue: function (color) { + this.underline.element.css("color", color); + }, + + getValue: function () { + return this.font.element.css("color"); + } +}); +BI.shortcut('bi.rich_editor_color_chooser_trigger', BI.RichEditorColorChooserTrigger);/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorBackgroundColorChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { + width: 20, + height: 20, + }); + }, + + _init: function () { + BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorchooser = BI.createWidget({ + type: "bi.color_chooser", + element: this, + width: o.width, + height: o.height, + el: { + type: "bi.rich_editor_background_color_chooser_trigger", + title: BI.i18nText("BI-Widget_Background_Colour"), + cls: "text-toolbar-button" + } + }); + this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { + var backgroundColor = this.getValue(); + o.editor.element.css({ + backgroundColor: backgroundColor, + color: BI.DOM.getContrastColor(backgroundColor) + }); + this.setValue(""); + }); + }, + + deactivate: function () { + } +}); +BI.shortcut('bi.rich_editor_background_color_chooser', BI.RichEditorBackgroundColorChooser);/** + * 颜色选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorColorChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { + width: 20, + height: 20, + command: "foreColor" + }); + }, + + _init: function () { + BI.RichEditorColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorchooser = BI.createWidget({ + type: "bi.color_chooser", + element: this, + width: o.width, + height: o.height, + el: { + type: "bi.rich_editor_color_chooser_trigger", + title: BI.i18nText("BI-Font_Colour"), + cls: "text-toolbar-button" + } + }); + this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { + self.doCommand(this.getValue()); + }); + + }, + + deactivate: function () { + this.colorchooser.setValue(""); + } +}); +BI.shortcut('bi.rich_editor_color_chooser', BI.RichEditorColorChooser);/** + * 字体大小选择 + * + * Created by GUY on 2015/11/26. + * @class BI.RichEditorSizeChooser + * @extends BI.RichEditorAction + */ +BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { + _defaultConfig: function () { + return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-rich-editor-size-chooser bi-border bi-card", + command: "FontSize", + width: 50, + height: 20 + }); + }, + + _items: [{ + value: 1, + text: "1(8pt)" + }, { + value: 2, + text: "2(10pt)" + }, { + value: 3, + text: "3(12pt)" + }, { + value: 4, + text: "4(14pt)" + }, { + value: 5, + text: "5(18pt)" + }, { + value: 6, + text: "6(24pt)" + }], + + _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_Size") + }); + + 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(this._items, { + 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([]); + }) + } +}); BI.shortcut('bi.rich_editor_size_chooser', BI.RichEditorSizeChooser);/** * 富文本编辑器 * @@ -58152,7 +58152,7 @@ BI.Table = BI.inherit(BI.Widget, { }, mounted: function () { - this._resize(); + this._resize && this._resize(); this.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT); }, @@ -58497,9 +58497,7 @@ BI.Table = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.Table.superclass._init.apply(this, arguments); - + render: function () { this.populate(this.options.items); }, @@ -78303,7 +78301,7 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { var self = this, o = this.options; var routes = this.pathChooser.routes; var pathes = this.pathChooser.pathes; - var store = this.pathChooser.store; + var cache = this.pathChooser.cache; this.arrows = {}; BI.each(routes, function (region, ps) { self.arrows[region] = []; @@ -78315,7 +78313,7 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { var arrow; if (dot.y === dots[i - 1].y) { if (dots[i + 1].y != dot.y) { - if (store[path[path.length - 2]].direction === -1) { + if (cache[path[path.length - 2]].direction === -1) { if (i - 1 > 0) { arrow = self._drawOneArrow(dots[i - 1], 3); } @@ -78325,13 +78323,13 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { } } else if (dot.x === dots[i - 1].x) { if (dot.y > dots[i - 1].y) { - if (store[BI.first(path)].direction === -1) { + if (cache[BI.first(path)].direction === -1) { arrow = self._drawOneArrow(dots[i - 1], 0); } else { arrow = self._drawOneArrow(dot, 2); } } else { - if (store[path[path.length - 2]].direction === -1) { + if (cache[path[path.length - 2]].direction === -1) { arrow = self._drawOneArrow(dots[i - 1], 2); } else { arrow = self._drawOneArrow(dot, 0); @@ -78347,7 +78345,7 @@ BI.DirectionPathChooser = BI.inherit(BI.Widget, { if (i !== 0) { var arrow; var from = path[i - 1]; - if (store[from].direction === -1) { + if (cache[from].direction === -1) { var regionIndex = self.pathChooser.getRegionIndexById(from); var x = getXoffsetByRegionIndex(regionIndex, -1); var y = getYByXoffset(dots, x); @@ -80622,6 +80620,1182 @@ BI.InteractiveArrangement = BI.inherit(BI.Widget, { BI.InteractiveArrangement.EVENT_RESIZE = "InteractiveArrangement.EVENT_RESIZE"; BI.InteractiveArrangement.EVENT_SCROLL = "InteractiveArrangement.EVENT_SCROLL"; BI.shortcut('bi.interactive_arrangement', BI.InteractiveArrangement);/** + * Created by zcf on 2016/9/26. + */ +BI.IntervalSlider = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 58, + EDITOR_R_GAP: 60, + EDITOR_HEIGHT: 30, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + + _defaultConfig: function () { + return BI.extend(BI.IntervalSlider.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-interval-slider bi-slider-track" + }) + }, + + _init: function () { + BI.IntervalSlider.superclass._init.apply(this, arguments); + + var self = this; + var c = this._constant; + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.calculation = new BI.AccurateCalculationModel(); + + // this.backgroundTrack = BI.createWidget({ + // type: "bi.layout", + // cls: "background-track", + // height: c.TRACK_HEIGHT + // }); + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + this.track = this._createTrackWrapper(); + + this.labelOne = BI.createWidget({ + type: "bi.sign_editor", + cls: "slider-editor-button", + errorText: "", + allowBlank: false, + width: c.EDITOR_WIDTH, + validationChecker: function (v) { + return self._checkValidation(v); + } + }); + this.labelOne.element.hover(function () { + self.labelOne.element.removeClass("bi-border").addClass("bi-border"); + }, function () { + self.labelOne.element.removeClass("bi-border"); + }); + this.labelOne.on(BI.Editor.EVENT_CONFIRM, function () { + var v = BI.parseFloat(this.getValue()); + self.valueOne = v; + var percent = self._getPercentByValue(v); + var significantPercent = BI.parseFloat(percent.toFixed(1));//分成1000份 + self._setLabelOnePosition(significantPercent); + self._setSliderOnePosition(significantPercent); + self._setBlueTrack(); + self.fireEvent(BI.IntervalSlider.EVENT_CHANGE); + }); + + this.labelTwo = BI.createWidget({ + type: "bi.sign_editor", + cls: "slider-editor-button", + errorText: "", + allowBlank: false, + width: c.EDITOR_WIDTH, + validationChecker: function (v) { + return self._checkValidation(v); + } + }); + this.labelTwo.element.hover(function () { + self.labelTwo.element.removeClass("bi-border").addClass("bi-border"); + }, function () { + self.labelTwo.element.removeClass("bi-border"); + }); + this.labelTwo.on(BI.Editor.EVENT_CONFIRM, function () { + var v = BI.parseFloat(this.getValue()); + self.valueTwo = v; + var percent = self._getPercentByValue(v); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setLabelTwoPosition(significantPercent); + self._setSliderTwoPosition(significantPercent); + self._setBlueTrack(); + self.fireEvent(BI.IntervalSlider.EVENT_CHANGE); + }); + + this.sliderOne = BI.createWidget({ + type: "bi.single_slider_button" + }); + this.sliderTwo = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.sliderOne, true); + this._draggable(this.sliderTwo, false); + this._setVisible(false); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 23, + left: 0, + width: "100%" + }, + this._createLabelWrapper(), + this._createSliderWrapper() + ] + }) + }, + + _rePosBySizeAfterMove: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + var v = this._getValueByPercent(significantPercent); + v = this._assertValue(v); + if(isLeft){ + this._setLabelOnePosition(significantPercent); + this._setSliderOnePosition(significantPercent); + this.labelOne.setValue(v); + this.valueOne = v; + }else{ + this._setLabelTwoPosition(significantPercent); + this._setSliderTwoPosition(significantPercent); + this.labelTwo.setValue(v); + this.valueTwo = v; + } + this._setBlueTrack(); + }, + + _rePosBySizeAfterStop: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + isLeft ? this._setSliderOnePosition(significantPercent) : this._setSliderTwoPosition(significantPercent); + }, + + _draggable: function (widget, isLeft) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + self._rePosBySizeAfterMove(size, isLeft); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + self._rePosBySizeAfterStop(size, isLeft); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.IntervalSlider.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createLabelWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.labelOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.labelTwo, + top: 0, + left: "100%" + }] + }], + rgap: c.EDITOR_R_GAP, + height: 70 + }, + top: 0, + left: 0, + width: "100%" + } + }, + + _createSliderWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.sliderOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.sliderTwo, + top: 0, + left: "100%" + }] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }, + top: 20, + left: 0, + width: "100%" + } + }, + + _createTrackWrapper: function () { + return BI.createWidget({ + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }] + }) + }, + + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _checkOverlap: function () { + var labelOneLeft = this.labelOne.element[0].offsetLeft; + var labelTwoLeft = this.labelTwo.element[0].offsetLeft; + if (labelOneLeft <= labelTwoLeft) { + if ((labelTwoLeft - labelOneLeft) < 90) { + this.labelTwo.element.css({"top": 40}); + } else { + this.labelTwo.element.css({"top": 0}); + } + } else { + if ((labelOneLeft - labelTwoLeft) < 90) { + this.labelTwo.element.css({"top": 40}); + } else { + this.labelTwo.element.css({"top": 0}); + } + } + }, + + _setLabelOnePosition: function (percent) { + this.labelOne.element.css({"left": percent + "%"}); + this._checkOverlap(); + }, + + _setLabelTwoPosition: function (percent) { + this.labelTwo.element.css({"left": percent + "%"}); + this._checkOverlap(); + }, + + _setSliderOnePosition: function (percent) { + this.sliderOne.element.css({"left": percent + "%"}); + }, + + _setSliderTwoPosition: function (percent) { + this.sliderTwo.element.css({"left": percent + "%"}); + }, + + _setBlueTrackLeft: function (percent) { + this.blueTrack.element.css({"left": percent + "%"}); + }, + + _setBlueTrackWidth: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setBlueTrack: function () { + var percentOne = this._getPercentByValue(this.labelOne.getValue()); + var percentTwo = this._getPercentByValue(this.labelTwo.getValue()); + if (percentOne <= percentTwo) { + this._setBlueTrackLeft(percentOne); + this._setBlueTrackWidth(percentTwo - percentOne); + } else { + this._setBlueTrackLeft(percentTwo); + this._setBlueTrackWidth(percentOne - percentTwo); + } + }, + + _setAllPosition: function (one, two) { + this._setSliderOnePosition(one); + this._setLabelOnePosition(one); + this._setSliderTwoPosition(two); + this._setLabelTwoPosition(two); + this._setBlueTrack(); + }, + + _setVisible: function (visible) { + this.sliderOne.setVisible(visible); + this.sliderTwo.setVisible(visible); + this.labelOne.setVisible(visible); + this.labelTwo.setVisible(visible); + }, + + _setErrorText: function () { + var errorText = BI.i18nText("BI-Please_Enter") + this.min + "-" + this.max + BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Basic_Number"); + this.labelOne.setErrorText(errorText); + this.labelTwo.setErrorText(errorText); + }, + + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + + //其中取max-min后保留4为有效数字后的值的小数位数为最终value的精度 + _getValueByPercent: function (percent) {//return (((max-min)*percent)/100+min) + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var mul = this.calculation.accurateMultiplication(sub, percent); + var div = this.calculation.accurateDivisionTenExponent(mul, 2); + if(this.precision < 0){ + var value = BI.parseFloat(this.calculation.accurateAddition(div, this.min)); + var reduceValue = Math.round(this.calculation.accurateDivisionTenExponent(value, -this.precision)); + return this.calculation.accurateMultiplication(reduceValue, Math.pow(10, -this.precision)); + }else{ + return BI.parseFloat(this.calculation.accurateAddition(div, this.min).toFixed(this.precision)); + } + }, + + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + _setDraggableEnable: function (enable) { + this.sliderOne.setEnable(enable); + this.sliderTwo.setEnable(enable); + }, + + _getPrecision: function () { + //计算每一份值的精度(最大值和最小值的差值保留4为有效数字后的精度) + //如果差值的整数位数大于4,toPrecision(4)得到的是科学计数法123456 => 1.235e+5 + //返回非负值: 保留的小数位数 + //返回负值: 保留的10^n精度中的n + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var pre = sub.toPrecision(4); + //科学计数法 + var eIndex = pre.indexOf("e"); + var arr = []; + if(eIndex > -1){ + arr = pre.split("e"); + var decimalPartLength = BI.size(arr[0].split(".")[1]); + var sciencePartLength = BI.parseInt(arr[1].substring(1)); + return decimalPartLength - sciencePartLength; + }else{ + arr = pre.split("."); + return arr.length > 1 ? arr[1].length : 0; + } + }, + + _assertValue: function (value) { + if(value <= this.min){ + return this.min + } + if(value >= this.max){ + return this.max; + } + return value; + }, + + getValue: function () { + if (this.valueOne <= this.valueTwo) { + return {min: this.valueOne, max: this.valueTwo} + } else { + return {min: this.valueTwo, max: this.valueOne} + } + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber >= minNumber )) { + this.min = minNumber; + this.max = maxNumber; + this.valueOne = minNumber; + this.valueTwo = maxNumber; + this.precision = this._getPrecision(); + this._setDraggableEnable(true); + } + if (maxNumber === minNumber) { + this._setDraggableEnable(false); + } + }, + + setValue: function (v) { + var valueOne = BI.parseFloat(v.min); + var valueTwo = BI.parseFloat(v.max); + if (!isNaN(valueOne) && !isNaN(valueTwo)) { + if (this._checkValidation(valueOne)) { + this.valueOne = valueOne; + } + if (this._checkValidation(valueTwo)) { + this.valueTwo = valueTwo; + } + if (valueOne < this.min) { + this.valueOne = this.min; + } + if (valueTwo > this.max) { + this.valueTwo = this.max; + } + } + }, + + reset: function () { + this._setVisible(false); + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.min = NaN; + this.max = NaN; + this._setBlueTrackWidth(0); + }, + + populate: function () { + if (!isNaN(this.min) && !isNaN(this.max)) { + this.enable = true; + this._setVisible(true); + this._setErrorText(); + if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { + this.labelOne.setValue(this.valueOne); + this.labelTwo.setValue(this.valueTwo); + this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); + } else { + this.labelOne.setValue(this.min); + this.labelTwo.setValue(this.max); + this._setAllPosition(0, 100) + } + } + } +}); +BI.IntervalSlider.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.interval_slider", BI.IntervalSlider);/** + * Created by zcf on 2016/9/26. + */ +BI.IntervalSliderLabel = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 58, + EDITOR_R_GAP: 60, + EDITOR_HEIGHT: 20, + HEIGHT: 20, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + + _defaultConfig: function () { + return BI.extend(BI.IntervalSliderLabel.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-interval-slider-label bi-slider-track", + digit: false, + unit: "" + }) + }, + + _init: function () { + BI.IntervalSliderLabel.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + var c = this._constant; + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.calculation = new BI.AccurateCalculationModel(); + + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + this.track = this._createTrackWrapper(); + + this.labelOne = BI.createWidget({ + type: "bi.label", + height: c.HEIGHT, + width: c.EDITOR_WIDTH + }); + + this.labelTwo = BI.createWidget({ + type: "bi.label", + height: c.HEIGHT, + width: c.EDITOR_WIDTH + }); + + this.sliderOne = BI.createWidget({ + type: "bi.single_slider_button" + }); + + this.sliderTwo = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.sliderOne, true); + this._draggable(this.sliderTwo, false); + this._setVisible(false); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 13, + left: 0, + width: "100%" + }, + this._createLabelWrapper(), + this._createSliderWrapper() + ] + }) + }, + + _rePosBySizeAfterMove: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + var v = this._getValueByPercent(significantPercent); + v = this._assertValue(v); + if(isLeft){ + this._setLabelOnePosition(significantPercent); + this._setSliderOnePosition(significantPercent); + this.labelOne.setValue(v); + this.valueOne = v; + }else{ + this._setLabelTwoPosition(significantPercent); + this._setSliderTwoPosition(significantPercent); + this.labelTwo.setValue(v); + this.valueTwo = v; + } + this._setBlueTrack(); + }, + + _rePosBySizeAfterStop: function (size, isLeft) { + var percent = size * 100 / (this._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + isLeft ? this._setSliderOnePosition(significantPercent) : this._setSliderTwoPosition(significantPercent); + }, + + _draggable: function (widget, isLeft) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + self._rePosBySizeAfterMove(size, isLeft); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + self._rePosBySizeAfterStop(size, isLeft); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.IntervalSliderLabel.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createLabelWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.labelOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.labelTwo, + top: 0, + left: "100%" + }] + }], + rgap: c.EDITOR_R_GAP, + height: 50 + }, + top: 0, + left: 0, + width: "100%" + } + }, + + _createSliderWrapper: function () { + var c = this._constant; + return { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.sliderOne, + top: 0, + left: "0%" + }] + }, { + type: "bi.absolute", + items: [{ + el: this.sliderTwo, + top: 0, + left: "100%" + }] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }, + top: 10, + left: 0, + width: "100%" + } + }, + + _createTrackWrapper: function () { + return BI.createWidget({ + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }] + }) + }, + + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _checkOverlap: function () { + var labelOneLeft = this.labelOne.element[0].offsetLeft; + var labelTwoLeft = this.labelTwo.element[0].offsetLeft; + if (labelOneLeft <= labelTwoLeft) { + if ((labelTwoLeft - labelOneLeft) < 90) { + this.labelTwo.element.css({"top": 30}); + } else { + this.labelTwo.element.css({"top": 0}); + } + } else { + if ((labelOneLeft - labelTwoLeft) < 90) { + this.labelTwo.element.css({"top": 30}); + } else { + this.labelTwo.element.css({"top": 0}); + } + } + }, + + _setLabelOnePosition: function (percent) { + this.labelOne.element.css({"left": percent + "%"}); + this._checkOverlap(); + }, + + _setLabelTwoPosition: function (percent) { + this.labelTwo.element.css({"left": percent + "%"}); + this._checkOverlap(); + }, + + _setSliderOnePosition: function (percent) { + this.sliderOne.element.css({"left": percent + "%"}); + }, + + _setSliderTwoPosition: function (percent) { + this.sliderTwo.element.css({"left": percent + "%"}); + }, + + _setBlueTrackLeft: function (percent) { + this.blueTrack.element.css({"left": percent + "%"}); + }, + + _setBlueTrackWidth: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setBlueTrack: function () { + var percentOne = this._getPercentByValue(this.labelOne.getValue()); + var percentTwo = this._getPercentByValue(this.labelTwo.getValue()); + if (percentOne <= percentTwo) { + this._setBlueTrackLeft(percentOne); + this._setBlueTrackWidth(percentTwo - percentOne); + } else { + this._setBlueTrackLeft(percentTwo); + this._setBlueTrackWidth(percentOne - percentTwo); + } + }, + + _setAllPosition: function (one, two) { + this._setSliderOnePosition(one); + this._setLabelOnePosition(one); + this._setSliderTwoPosition(two); + this._setLabelTwoPosition(two); + this._setBlueTrack(); + }, + + _setVisible: function (visible) { + this.sliderOne.setVisible(visible); + this.sliderTwo.setVisible(visible); + this.labelOne.setVisible(visible); + this.labelTwo.setVisible(visible); + }, + + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + + //其中取max-min后保留4为有效数字后的值的小数位数为最终value的精度 + _getValueByPercent: function (percent) {//return (((max-min)*percent)/100+min) + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var mul = this.calculation.accurateMultiplication(sub, percent); + var div = this.calculation.accurateDivisionTenExponent(mul, 2); + if (this.precision < 0) { + var value = BI.parseFloat(this.calculation.accurateAddition(div, this.min)); + var reduceValue = Math.round(this.calculation.accurateDivisionTenExponent(value, -this.precision)); + return this.calculation.accurateMultiplication(reduceValue, Math.pow(10, -this.precision)); + } else { + return BI.parseFloat(this.calculation.accurateAddition(div, this.min).toFixed(this.precision)); + } + }, + + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + _setDraggableEnable: function (enable) { + this.sliderOne.setEnable(enable); + this.sliderTwo.setEnable(enable); + }, + + _getPrecision: function () { + //计算每一份值的精度(最大值和最小值的差值保留4为有效数字后的精度) + //如果差值的整数位数大于4,toPrecision(4)得到的是科学计数法123456 => 1.235e+5 + //返回非负值: 保留的小数位数 + //返回负值: 保留的10^n精度中的n + var sub = this.calculation.accurateSubtraction(this.max, this.min); + var pre = sub.toPrecision(4); + //科学计数法 + var eIndex = pre.indexOf("e"); + var arr = []; + if (eIndex > -1) { + arr = pre.split("e"); + var decimalPartLength = BI.size(arr[0].split(".")[1]); + var sciencePartLength = BI.parseInt(arr[1].substring(1)); + return decimalPartLength - sciencePartLength; + } else { + arr = pre.split("."); + return arr.length > 1 ? arr[1].length : 0; + } + }, + + _assertValue: function (value) { + if (value <= this.min) { + return this.min + } + if (value >= this.max) { + return this.max; + } + return value; + }, + + getValue: function () { + if (this.valueOne <= this.valueTwo) { + return {min: this.valueOne, max: this.valueTwo} + } else { + return {min: this.valueTwo, max: this.valueOne} + } + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber >= minNumber )) { + this.min = minNumber; + this.max = maxNumber; + this.valueOne = minNumber; + this.valueTwo = maxNumber; + this.precision = this._getPrecision(); + this._setDraggableEnable(true); + } + if (maxNumber === minNumber) { + this._setDraggableEnable(false); + } + }, + + setValue: function (v) { + var o = this.options; + var valueOne = BI.parseFloat(v.min); + var valueTwo = BI.parseFloat(v.max); + valueOne = o.digit === false ? valueOne : valueOne.toFixed(o.digit); + if (!isNaN(valueOne) && !isNaN(valueTwo)) { + if (this._checkValidation(valueOne)) { + this.valueOne = valueOne; + } + if (this._checkValidation(valueTwo)) { + this.valueTwo = valueTwo; + } + if (valueOne < this.min) { + this.valueOne = this.min; + } + if (valueTwo > this.max) { + this.valueTwo = this.max; + } + } + }, + + reset: function () { + this._setVisible(false); + this.enable = false; + this.valueOne = ""; + this.valueTwo = ""; + this.min = NaN; + this.max = NaN; + this._setBlueTrackWidth(0); + }, + + populate: function () { + var o = this.options; + if (!isNaN(this.min) && !isNaN(this.max)) { + this.enable = true; + this._setVisible(true); + if ((BI.isNumeric(this.valueOne) || BI.isNotEmptyString(this.valueOne)) && (BI.isNumeric(this.valueTwo) || BI.isNotEmptyString(this.valueTwo))) { + this.labelOne.setValue(this.valueOne); + this.labelTwo.setValue(this.valueTwo); + this.labelOne.setText(this.valueOne + o.unit); + this.labelTwo.setText(this.valueTwo + o.unit); + this._setAllPosition(this._getPercentByValue(this.valueOne), this._getPercentByValue(this.valueTwo)); + } else { + this.labelOne.setValue(this.min); + this.labelTwo.setValue(this.max); + this.labelOne.setText(this.min + o.unit); + this.labelTwo.setText(this.max + o.unit); + this._setAllPosition(0, 100) + } + } + } +}); +BI.IntervalSliderLabel.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.interval_slider_label", BI.IntervalSliderLabel);/** + * Created by zcf on 2017/3/1. + * 万恶的IEEE-754 + * 使用字符串精确计算含小数加法、减法、乘法和10的指数倍除法,支持负数 + */ +BI.AccurateCalculationModel = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.AccurateCalculationModel.superclass._defaultConfig.apply(this, arguments), { + baseCls: "" + }) + }, + + _init: function () { + BI.AccurateCalculationModel.superclass._init.apply(this, arguments); + }, + + _getMagnitude: function (n) { + var magnitude = "1"; + for (var i = 0; i < n; i++) { + magnitude += "0"; + } + return BI.parseInt(magnitude); + }, + + _formatDecimal: function (stringNumber1, stringNumber2) { + if (stringNumber1.numDecimalLength === stringNumber2.numDecimalLength) { + return; + } + var magnitudeDiff = stringNumber1.numDecimalLength - stringNumber2.numDecimalLength; + if (magnitudeDiff > 0) { + var needAddZero = stringNumber2 + } else { + var needAddZero = stringNumber1; + magnitudeDiff = (0 - magnitudeDiff); + } + for (var i = 0; i < magnitudeDiff; i++) { + if (needAddZero.numDecimal === "0" && i === 0) { + continue + } + needAddZero.numDecimal += "0" + } + }, + + _stringNumberFactory: function (num) { + var strNum = num.toString(); + var numStrArray = strNum.split("."); + var numInteger = numStrArray[0]; + if (numStrArray.length === 1) { + var numDecimal = "0"; + var numDecimalLength = 0; + } else { + var numDecimal = numStrArray[1]; + var numDecimalLength = numStrArray[1].length; + } + return { + "numInteger": numInteger, + "numDecimal": numDecimal, + "numDecimalLength": numDecimalLength + } + }, + + _accurateSubtraction: function (num1, num2) {//num1-num2 && num1>num2 + var stringNumber1 = this._stringNumberFactory(num1); + var stringNumber2 = this._stringNumberFactory(num2); + //整数部分计算 + var integerResult = BI.parseInt(stringNumber1.numInteger) - BI.parseInt(stringNumber2.numInteger); + //小数部分 + this._formatDecimal(stringNumber1, stringNumber2); + var decimalMaxLength = getDecimalMaxLength(stringNumber1, stringNumber2); + + if (BI.parseInt(stringNumber1.numDecimal) >= BI.parseInt(stringNumber2.numDecimal)) { + var decimalResultTemp = (BI.parseInt(stringNumber1.numDecimal) - BI.parseInt(stringNumber2.numDecimal)).toString(); + var decimalResult = addZero(decimalResultTemp, decimalMaxLength); + } else {//否则借位 + integerResult--; + var borrow = this._getMagnitude(decimalMaxLength); + var decimalResultTemp = (borrow + BI.parseInt(stringNumber1.numDecimal) - BI.parseInt(stringNumber2.numDecimal)).toString(); + var decimalResult = addZero(decimalResultTemp, decimalMaxLength); + } + var result = integerResult + "." + decimalResult; + return BI.parseFloat(result); + + function getDecimalMaxLength(num1, num2) { + if (num1.numDecimal.length >= num2.numDecimal.length) { + return num1.numDecimal.length + } + return num2.numDecimal.length + } + + function addZero(resultTemp, length) { + var diff = length - resultTemp.length; + for (var i = 0; i < diff; i++) { + resultTemp = "0" + resultTemp; + } + return resultTemp + } + }, + + _accurateAddition: function (num1, num2) {//加法结合律 + var stringNumber1 = this._stringNumberFactory(num1); + var stringNumber2 = this._stringNumberFactory(num2); + //整数部分计算 + var integerResult = BI.parseInt(stringNumber1.numInteger) + BI.parseInt(stringNumber2.numInteger); + //小数部分 + this._formatDecimal(stringNumber1, stringNumber2); + + var decimalResult = (BI.parseInt(stringNumber1.numDecimal) + BI.parseInt(stringNumber2.numDecimal)).toString(); + + if (decimalResult !== "0") { + if (decimalResult.length <= stringNumber1.numDecimal.length) { + decimalResult = addZero(decimalResult, stringNumber1.numDecimal.length) + } else { + integerResult++;//进一 + decimalResult = decimalResult.slice(1); + } + } + var result = integerResult + "." + decimalResult; + return BI.parseFloat(result); + + function addZero(resultTemp, length) { + var diff = length - resultTemp.length; + for (var i = 0; i < diff; i++) { + resultTemp = "0" + resultTemp; + } + return resultTemp + } + }, + + _accurateMultiplication: function (num1, num2) {//乘法分配律 + var stringNumber1 = this._stringNumberFactory(num1); + var stringNumber2 = this._stringNumberFactory(num2); + //整数部分计算 + var integerResult = BI.parseInt(stringNumber1.numInteger) * BI.parseInt(stringNumber2.numInteger); + //num1的小数和num2的整数 + var dec1Int2 = this._accurateDivisionTenExponent(BI.parseInt(stringNumber1.numDecimal) * BI.parseInt(stringNumber2.numInteger), stringNumber1.numDecimalLength); + //num1的整数和num2的小数 + var int1dec2 = this._accurateDivisionTenExponent(BI.parseInt(stringNumber1.numInteger) * BI.parseInt(stringNumber2.numDecimal), stringNumber2.numDecimalLength); + //小数*小数 + var dec1dec2 = this._accurateDivisionTenExponent(BI.parseInt(stringNumber1.numDecimal) * BI.parseInt(stringNumber2.numDecimal), (stringNumber1.numDecimalLength + stringNumber2.numDecimalLength)); + + return this._accurateAddition(this._accurateAddition(this._accurateAddition(integerResult, dec1Int2), int1dec2), dec1dec2); + }, + + _accurateDivisionTenExponent: function (num, n) {// num/10^n && n>0 + var stringNumber = this._stringNumberFactory(num); + if (stringNumber.numInteger.length > n) { + var integerResult = stringNumber.numInteger.slice(0, (stringNumber.numInteger.length - n)); + var partDecimalResult = stringNumber.numInteger.slice(-n); + } else { + var integerResult = "0"; + var partDecimalResult = addZero(stringNumber.numInteger, n); + } + var result = integerResult + "." + partDecimalResult + stringNumber.numDecimal; + return BI.parseFloat(result); + + function addZero(resultTemp, length) { + var diff = length - resultTemp.length; + for (var i = 0; i < diff; i++) { + resultTemp = "0" + resultTemp; + } + return resultTemp + } + }, + + accurateSubtraction: function (num1, num2) { + if (num1 >= 0 && num2 >= 0) { + if (num1 >= num2) { + return this._accurateSubtraction(num1, num2) + } + return -this._accurateSubtraction(num2, num1) + } + if (num1 >= 0 && num2 < 0) { + return this._accurateAddition(num1, -num2) + } + if (num1 < 0 && num2 >= 0) { + return -this._accurateAddition(-num1, num2) + } + if (num1 < 0 && num2 < 0) { + if (num1 >= num2) { + return this._accurateSubtraction(-num2, -num1) + } + return this._accurateSubtraction(-num1, -num2) + } + }, + + accurateAddition: function (num1, num2) { + if (num1 >= 0 && num2 >= 0) { + return this._accurateAddition(num1, num2) + } + if (num1 >= 0 && num2 < 0) { + return this.accurateSubtraction(num1, -num2) + } + if (num1 < 0 && num2 >= 0) { + return this.accurateSubtraction(num2, -num1) + } + if (num1 < 0 && num2 < 0) { + return -this._accurateAddition(-num1, -num2) + } + }, + + accurateMultiplication: function (num1, num2) { + if (num1 >= 0 && num2 >= 0) { + return this._accurateMultiplication(num1, num2) + } + if (num1 >= 0 && num2 < 0) { + return -this._accurateMultiplication(num1, -num2) + } + if (num1 < 0 && num2 >= 0) { + return -this._accurateMultiplication(-num1, num2) + } + if (num1 < 0 && num2 < 0) { + return this._accurateMultiplication(-num1, -num2) + } + }, + + accurateDivisionTenExponent: function (num1, n) { + if (num1 >= 0) { + return this._accurateDivisionTenExponent(num1, n); + } + return -this._accurateDivisionTenExponent(-num1, n); + } +});/** * 月份下拉框 * * Created by GUY on 2015/8/28. @@ -87959,7 +89133,7 @@ BI.PathChooser = BI.inherit(BI.Widget, { }, getRegionIndexById: function (id) { - var node = this.store[id]; + var node = this.cache[id]; var regionType = node.get("region"); return this.regionMap[regionType]; }, @@ -88176,7 +89350,7 @@ BI.PathChooser = BI.inherit(BI.Widget, { _createNodes: function () { var self = this, o = this.options; - this.store = {}; + this.cache = {}; this.texts = {}; this.start = []; this.end = []; @@ -88200,10 +89374,10 @@ BI.PathChooser = BI.inherit(BI.Widget, { if (j > 0) { prev = items[j - 1]; } - var parent = self.store[prev.value || ""]; - var node = self.store[item.value] || new BI.Node(item.value); + var parent = self.cache[prev.value || ""]; + var node = self.cache[item.value] || new BI.Node(item.value); node.set(item); - self.store[item.value] = node; + self.cache[item.value] = node; self.texts[item.value] = item.text; self.texts[item.region] = item.regionText; parent = BI.isNull(parent) ? tree.getRoot() : parent; @@ -91073,6 +92247,931 @@ BI.SequenceTable = BI.inherit(BI.Widget, { } }); BI.shortcut('bi.sequence_table', BI.SequenceTable);/** + * Created by zcf on 2016/9/22. + */ +BI.SliderIconButton = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SliderIconButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-slider-button" + }); + }, + _init: function () { + BI.extend(BI.SliderIconButton.superclass._init.apply(this, arguments)); + this.slider = BI.createWidget({ + type: "bi.icon_button", + cls: "slider-icon slider-button", + iconWidth: 14, + iconHeight: 14, + height: 14, + width: 14 + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.slider, + top: 7, + left: -7 + }], + width: 0, + height: 14 + }); + } +}); +BI.shortcut("bi.single_slider_button", BI.SliderIconButton);/** + * Created by zcf on 2016/9/22. + */ +BI.SingleSlider = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 90, + EDITOR_HEIGHT: 30, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + _defaultConfig: function () { + return BI.extend(BI.SingleSlider.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-slider bi-slider-track", + digit: false + }); + }, + _init: function () { + BI.SingleSlider.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + var c = this._constant; + this.enable = false; + this.value = ""; + + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + this.track = this._createTrackWrapper(); + + this.slider = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.slider); + var sliderVertical = BI.createWidget({ + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.slider] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }); + sliderVertical.element.click(function (e) { + if (self.enable) { + var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; + var trackLength = self.track.element[0].scrollWidth; + var percent = 0; + if (offset < 0) { + percent = 0 + } + if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + percent = offset * 100 / self._getGrayTrackLength(); + } + if (offset > (trackLength - c.SLIDER_WIDTH)) { + percent = 100 + } + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + } + }); + this.label = BI.createWidget({ + type: "bi.sign_editor", + cls: "slider-editor-button", + errorText: "", + width: c.EDITOR_WIDTH - 2, + allowBlank: false, + validationChecker: function (v) { + return self._checkValidation(v); + }, + quitChecker: function (v) { + return self._checkValidation(v); + } + }); + this.label.element.hover(function () { + self.label.element.removeClass("bi-border").addClass("bi-border"); + }, function () { + self.label.element.removeClass("bi-border"); + }); + this.label.on(BI.SignEditor.EVENT_CONFIRM, function () { + var v = BI.parseFloat(this.getValue()); + var percent = self._getPercentByValue(v); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + this.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + }); + this._setVisible(false); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 23, + left: 0, + width: "100%" + }, { + el: sliderVertical, + top: 20, + left: 0, + width: "100%" + }, { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.label] + }], + rgap: c.EDITOR_WIDTH, + height: c.EDITOR_HEIGHT + }, + top: 0, + left: 0, + width: "100%" + }] + }) + }, + + _draggable: function (widget) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1));//直接对计算出来的百分数保留到小数点后一位,相当于分成了1000份。 + self._setBlueTrack(significantPercent); + self._setLabelPosition(significantPercent); + self._setSliderPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setSliderPosition(significantPercent); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createTrackWrapper: function () { + return BI.createWidget({ + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }] + }) + }, + + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _setBlueTrack: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setLabelPosition: function (percent) { + this.label.element.css({"left": percent + "%"}); + }, + + _setSliderPosition: function (percent) { + this.slider.element.css({"left": percent + "%"}); + }, + + _setAllPosition: function (percent) { + this._setSliderPosition(percent); + this._setLabelPosition(percent); + this._setBlueTrack(percent); + }, + + _setVisible: function (visible) { + this.slider.setVisible(visible); + this.label.setVisible(visible); + }, + + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + + _getValueByPercent: function (percent) { + var thousandth = BI.parseInt(percent * 10); + return (((this.max - this.min) * thousandth) / 1000 + this.min); + }, + + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + getValue: function () { + return this.value; + }, + + setValue: function (v) { + var o = this.options; + v = BI.parseFloat(v); + v = o.digit === false ? v : v.toFixed(o.digit); + if ((!isNaN(v))) { + if (this._checkValidation(v)) { + this.value = v; + } + if (v > this.max) { + this.value = this.max; + } + if (v < this.min) { + this.value = this.min; + } + } + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + this.min = minNumber; + this.max = maxNumber; + } + }, + + reset: function () { + this._setVisible(false); + this.enable = false; + this.value = ""; + this.min = 0; + this.max = 0; + this._setBlueTrack(0); + + }, + + populate: function () { + if (!isNaN(this.min) && !isNaN(this.max)) { + this._setVisible(true); + this.enable = true; + this.label.setErrorText(BI.i18nText("BI-Please_Enter") + this.min + "-" + this.max + BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Basic_Number")); + if (BI.isNumeric(this.value) || BI.isNotEmptyString(this.value)) { + this.label.setValue(this.value); + this._setAllPosition(this._getPercentByValue(this.value)); + } else { + this.label.setValue(this.max); + this._setAllPosition(100); + } + } + } +}); +BI.SingleSlider.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.single_slider", BI.SingleSlider);/** + * Created by Urthur on 2017/9/12. + */ +BI.SingleSliderLabel = BI.inherit(BI.Widget, { + _constant: { + EDITOR_WIDTH: 90, + EDITOR_HEIGHT: 20, + HEIGHT: 20, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + _defaultConfig: function () { + return BI.extend(BI.SingleSliderLabel.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-slider-label bi-slider-track", + digit: false, + unit: "" + }); + }, + _init: function () { + BI.SingleSliderLabel.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + var c = this._constant; + this.enable = false; + this.value = ""; + + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + this.track = this._createTrackWrapper(); + + this.slider = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.slider); + var sliderVertical = BI.createWidget({ + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.slider] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }); + sliderVertical.element.click(function (e) { + if (self.enable) { + var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; + var trackLength = self.track.element[0].scrollWidth; + var percent = 0; + if (offset < 0) { + percent = 0 + } + if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + percent = offset * 100 / self._getGrayTrackLength(); + } + if (offset > (trackLength - c.SLIDER_WIDTH)) { + percent = 100 + } + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setText(v + o.unit); + self.value = v; + self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); + } + }); + this.label = BI.createWidget({ + type: "bi.label", + height: c.HEIGHT, + width: c.EDITOR_WIDTH - 2 + }); + + this._setVisible(false); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 13, + left: 0, + width: "100%" + }, { + el: sliderVertical, + top: 10, + left: 0, + width: "100%" + }, { + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.label] + }], + rgap: c.EDITOR_WIDTH, + height: c.EDITOR_HEIGHT + }, + top: 0, + left: 0, + width: "100%" + }] + }) + }, + + _draggable: function (widget) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1));//直接对计算出来的百分数保留到小数点后一位,相当于分成了1000份。 + self._setBlueTrack(significantPercent); + self._setLabelPosition(significantPercent); + self._setSliderPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.label.setValue(v); + self.value = v; + self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setSliderPosition(significantPercent); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.SingleSliderLabel.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createTrackWrapper: function () { + return BI.createWidget({ + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }] + }) + }, + + _checkValidation: function (v) { + return BI.isNumeric(v) && !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _setBlueTrack: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setLabelPosition: function (percent) { + this.label.element.css({"left": percent + "%"}); + }, + + _setSliderPosition: function (percent) { + this.slider.element.css({"left": percent + "%"}); + }, + + _setAllPosition: function (percent) { + this._setSliderPosition(percent); + this._setLabelPosition(percent); + this._setBlueTrack(percent); + }, + + _setVisible: function (visible) { + this.slider.setVisible(visible); + this.label.setVisible(visible); + }, + + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + + _getValueByPercent: function (percent) { + var thousandth = BI.parseInt(percent * 10); + return (((this.max - this.min) * thousandth) / 1000 + this.min); + }, + + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + getValue: function () { + return this.value; + }, + + setValue: function (v) { + var o = this.options; + v = BI.parseFloat(v); + v = o.digit === false ? v : v.toFixed(o.digit); + if ((!isNaN(v))) { + if (this._checkValidation(v)) { + this.value = v; + } + if (v > this.max) { + this.value = this.max; + } + if (v < this.min) { + this.value = this.min; + } + } + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + this.min = minNumber; + this.max = maxNumber; + } + }, + + reset: function () { + this._setVisible(false); + this.enable = false; + this.value = ""; + this.min = 0; + this.max = 0; + this._setBlueTrack(0); + }, + + populate: function () { + var o = this.options; + if (!isNaN(this.min) && !isNaN(this.max)) { + this._setVisible(true); + this.enable = true; + if (BI.isNumeric(this.value) || BI.isNotEmptyString(this.value)) { + this.label.setValue(this.value + o.unit); + this._setAllPosition(this._getPercentByValue(this.value)); + } else { + this.label.setValue(this.max + o.unit); + this._setAllPosition(100); + } + } + } +}); +BI.SingleSliderLabel.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.single_slider_label", BI.SingleSliderLabel);/** + * normal single slider + * Created by Young on 2017/6/21. + */ +BI.SingleSliderNormal = BI.inherit(BI.Widget, { + + _constant: { + HEIGHT: 28, + SLIDER_WIDTH_HALF: 15, + SLIDER_WIDTH: 30, + SLIDER_HEIGHT: 30, + TRACK_HEIGHT: 24 + }, + + props: { + baseCls: "bi-single-slider-normal bi-slider-track", + minMax: { + min: 0, + max: 100 + }, + // color: "#3f8ce8" + }, + + render: function () { + var self = this; + var c = this._constant; + var track = this._createTrack(); + this.slider = BI.createWidget({ + type: "bi.single_slider_button" + }); + this._draggable(this.slider); + + var sliderVertical = BI.createWidget({ + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [this.slider] + }], + hgap: c.SLIDER_WIDTH_HALF, + height: c.SLIDER_HEIGHT + }); + sliderVertical.element.click(function (e) { + if (self.enable) { + var offset = e.clientX - self.element.offset().left - c.SLIDER_WIDTH_HALF; + var trackLength = self.track.element[0].scrollWidth; + var percent = 0; + if (offset < 0) { + percent = 0 + } + if (offset > 0 && offset < (trackLength - c.SLIDER_WIDTH)) { + percent = offset * 100 / self._getGrayTrackLength(); + } + if (offset > (trackLength - c.SLIDER_WIDTH)) { + percent = 100 + } + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setAllPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + self.value = v; + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + } + }); + + return { + type: "bi.absolute", + element: this, + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: track, + width: "100%", + height: c.TRACK_HEIGHT + }] + }], + hgap: 7, + height: c.TRACK_HEIGHT + }, + top: 3, + left: 0, + width: "100%" + }, { + el: sliderVertical, + top: 0, + left: 0, + width: "100%" + }] + } + }, + + _draggable: function (widget) { + var self = this, o = this.options; + var startDrag = false; + var size = 0, offset = 0, defaultSize = 0; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + widget.element.addClass("dragging"); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1));//直接对计算出来的百分数保留到小数点后一位,相当于分成了1000份。 + self._setBlueTrack(significantPercent); + self._setSliderPosition(significantPercent); + var v = self._getValueByPercent(significantPercent); + v = o.digit === false ? v : v.toFixed(o.digit); + self.value = v; + self.fireEvent(BI.SingleSliderNormal.EVENT_DRAG, v); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + var percent = size * 100 / (self._getGrayTrackLength()); + var significantPercent = BI.parseFloat(percent.toFixed(1)); + self._setSliderPosition(significantPercent); + size = 0; + offset = 0; + defaultSize = size; + startDrag = false; + } + widget.element.removeClass("dragging"); + mouseMoveTracker.releaseMouseMoves(); + self.fireEvent(BI.SingleSlider.EVENT_CHANGE); + }, document); + widget.element.on("mousedown", function (event) { + if(!widget.isEnabled()){ + return; + } + defaultSize = this.offsetLeft; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + + function optimizeSize(s) { + return BI.clamp(s, 0, o.width); + } + }, + + _createTrack: function () { + var self = this; + var c = this._constant; + this.grayTrack = BI.createWidget({ + type: "bi.layout", + cls: "gray-track", + height: 6 + }); + this.blueTrack = BI.createWidget({ + type: "bi.layout", + cls: "blue-track bi-high-light-background", + height: 6 + }); + if (this.options.color) { + this.blueTrack.element.css({"background-color": this.options.color}); + } + + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.vertical", + items: [{ + type: "bi.absolute", + items: [{ + el: this.grayTrack, + top: 0, + left: 0, + width: "100%" + }, { + el: this.blueTrack, + top: 0, + left: 0, + width: "0%" + }] + }], + hgap: 8, + height: 8 + }, + top: 8, + left: 0, + width: "100%" + }], + ref: function (ref) { + self.track = ref; + } + } + }, + + _checkValidation: function (v) { + return !(BI.isNull(v) || v < this.min || v > this.max) + }, + + _setBlueTrack: function (percent) { + this.blueTrack.element.css({"width": percent + "%"}); + }, + + _setSliderPosition: function (percent) { + this.slider.element.css({"left": percent + "%"}); + }, + + _setAllPosition: function (percent) { + this._setSliderPosition(percent); + this._setBlueTrack(percent); + }, + + _setVisible: function (visible) { + this.slider.setVisible(visible); + }, + + _getGrayTrackLength: function () { + return this.grayTrack.element[0].scrollWidth + }, + + _getValueByPercent: function (percent) { + var thousandth = BI.parseInt(percent * 10); + return (((this.max - this.min) * thousandth) / 1000 + this.min); + }, + + _getPercentByValue: function (v) { + return (v - this.min) * 100 / (this.max - this.min); + }, + + getValue: function () { + return this.value; + }, + + setValue: function (v) { + var value = BI.parseFloat(v); + if ((!isNaN(value))) { + if (this._checkValidation(value)) { + this.value = value; + } + if (value > this.max) { + this.value = this.max; + } + if (value < this.min) { + this.value = this.min; + } + } + }, + + setMinAndMax: function (v) { + var minNumber = BI.parseFloat(v.min); + var maxNumber = BI.parseFloat(v.max); + if ((!isNaN(minNumber)) && (!isNaN(maxNumber)) && (maxNumber > minNumber )) { + this.min = minNumber; + this.max = maxNumber; + } + }, + + reset: function () { + this._setVisible(false); + this.enable = false; + this.value = ""; + this.min = 0; + this.max = 0; + this._setBlueTrack(0); + }, + + populate: function () { + if (!isNaN(this.min) && !isNaN(this.max)) { + this._setVisible(true); + this.enable = true; + if (BI.isNumeric(this.value) || BI.isNotEmptyString(this.value)) { + this._setAllPosition(this._getPercentByValue(this.value)); + } else { + this._setAllPosition(100); + } + } + } +}); +BI.SingleSliderNormal.EVENT_DRAG = "EVENT_DRAG"; +BI.shortcut("bi.single_slider_normal", BI.SingleSliderNormal);/** * @class BI.SingleTreeCombo * @extends BI.Widget */ diff --git a/dist/bundle.min.css b/dist/bundle.min.css index 5129bfa09..7423d27b7 100644 --- a/dist/bundle.min.css +++ b/dist/bundle.min.css @@ -1 +1 @@ -/*! normalize.css v1.0.0 | MIT License | git.io/normalize */dl,h3,menu,ol,p,pre,ul{margin:1em 0}.cm-em,dfn{font-style:italic}.bi-label,.bi-text,.overflow-dot{text-overflow:ellipsis}.bi-excel-table-header-cell,.bi-preview-table-header-cell,.cm-header,.cm-strong,b,strong{font-weight:700}.b-font,i{-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.75em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}blockquote{margin:1em 40px}mark{background:#ff0;color:#000}.base-disabled,.base-disabled .b-font:before,.base-disabled .bi-input,.base-disabled .bi-textarea{color:#ccc!important}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}small,sub,sup{font-size:75%}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:after,q:before{content:'';content:none}sub,sup{line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ol,nav ul{list-style:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure,form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline}button,input{line-height:normal}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],input[disabled]{cursor:default}.base-disabled,.base-invalid{cursor:default!important}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.bi-collection-table-cell,.bi-text,.border-sizing{-moz-box-sizing:border-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}*,a,body,div,html,img,li,ol,p,span,ul{margin:0;padding:0}a{outline:0;text-decoration:none}a:focus{outline:0}input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}input::-ms-clear{display:none}input,textarea{margin:0;padding:0;outline:0;border:1px solid #d4dadd}.bi-theme-dark input,.bi-theme-dark textarea{border:1px solid #525466}ul{list-style:disc}li{list-style-type:none}i{-webkit-font-smoothing:antialiased}.bi-theme-dark .base-disabled,.bi-theme-dark .base-disabled .b-font:before,.bi-theme-dark .base-disabled .bi-input,.bi-theme-dark .base-disabled .bi-textarea{color:#666!important}.clearfix:after,.clearfix:before{content:" ";display:table;line-height:0}.clearfix:after{clear:both}.bi-background{background-color:#eff1f4;color:#666}.bi-background .bi-input,.bi-background .bi-textarea{color:#666}.bi-theme-dark .bi-background{background-color:#191b2b;color:#ccc}.bi-theme-dark .bi-background .bi-input,.bi-theme-dark .bi-background .bi-textarea{color:#ccc}.bi-card,.bi-card .bi-input,.bi-card .bi-textarea{color:#666}.bi-card{background-color:#fff}.bi-theme-dark .bi-card{background-color:#242640;color:#ccc}.bi-disabled,.bi-disabled .bi-input,.bi-disabled .bi-textarea,.bi-theme-dark .bi-card .bi-input,.bi-theme-dark .bi-card .bi-textarea{color:#ccc}.bi-theme-dark .bi-disabled,.bi-theme-dark .bi-disabled .bi-input,.bi-theme-dark .bi-disabled .bi-textarea{color:#666}.bi-tips,.bi-tips .bi-input,.bi-tips .bi-textarea{color:#999}.bi-border{border:1px solid #d4dadd}.bi-theme-dark .bi-border{border:1px solid #525466}.bi-border-left{border-left:1px solid #d4dadd}.bi-theme-dark .bi-border-left{border-left:1px solid #525466}.bi-border-right{border-right:1px solid #d4dadd}.bi-theme-dark .bi-border-right{border-right:1px solid #525466}.bi-border-top{border-top:1px solid #d4dadd}.bi-theme-dark .bi-border-top{border-top:1px solid #525466}.bi-border-bottom{border-bottom:1px solid #d4dadd}.bi-theme-dark .bi-border-bottom{border-bottom:1px solid #525466}.bi-keyword-red-mark,.bi-keyword-red-mark .bi-input,.bi-keyword-red-mark .bi-textarea{color:#f07d0a}.bi-high-light,.bi-high-light .bi-input,.bi-high-light .bi-textarea{color:#3f8ce8}.bi-high-light-background{background-color:#3f8ce8;color:#fff}.bi-high-light-background .bi-input,.bi-high-light-background .bi-textarea{color:#fff}.bi-high-light-border{border-color:#178cdf}.bi-water-mark{color:#ccc;cursor:text}.bi-water-mark .bi-input,.bi-water-mark .bi-textarea{color:#ccc}.bi-theme-dark .bi-water-mark,.bi-theme-dark .bi-water-mark .bi-input,.bi-theme-dark .bi-water-mark .bi-textarea{color:#666}.bi-mask,.bi-mask .bi-input,.bi-mask .bi-textarea{color:#fff}.bi-resizer{background:#1a1a1a;opacity:.2;filter:alpha(opacity=20);z-index:1000000000!important}.bi-theme-dark .bi-resizer{background:#fff}.bi-mask{background-color:rgba(26,26,26,.2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#331a1a1a, endColorstr=#331a1a1a)}.bi-theme-dark .bi-mask{color:#242640;background-color:rgba(255,255,255,.2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff, endColorstr=#33ffffff)}.bi-theme-dark .bi-mask .bi-input,.bi-theme-dark .bi-mask .bi-textarea{color:#242640}.bi-z-index-mask{color:#fff;background-color:rgba(26,26,26,.5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a, endColorstr=#801a1a1a)}.bi-z-index-mask .bi-input,.bi-z-index-mask .bi-textarea{color:#fff}.bi-list-item.hover,.bi-list-item:hover{color:#1a1a1a;background-color:rgba(26,26,26,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a, endColorstr=#0d1a1a1a)}.bi-list-item.hover .bi-input,.bi-list-item.hover .bi-textarea,.bi-list-item:hover .bi-input,.bi-list-item:hover .bi-textarea{color:#1a1a1a}.bi-list-item.disabled,.bi-list-item.disabled:active,.bi-list-item.disabled:hover{background-color:transparent!important;color:#ccc!important}.bi-list-item.disabled .bi-high-light,.bi-list-item.disabled .bi-input,.bi-list-item.disabled .bi-textarea,.bi-list-item.disabled:active .bi-high-light,.bi-list-item.disabled:active .bi-input,.bi-list-item.disabled:active .bi-textarea,.bi-list-item.disabled:hover .bi-high-light,.bi-list-item.disabled:hover .bi-input,.bi-list-item.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item.hover,.bi-theme-dark .bi-list-item:hover{color:#fff;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item.hover .bi-input,.bi-theme-dark .bi-list-item.hover .bi-textarea,.bi-theme-dark .bi-list-item:hover .bi-input,.bi-theme-dark .bi-list-item:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item.disabled,.bi-theme-dark .bi-list-item.disabled:active,.bi-theme-dark .bi-list-item.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item.disabled .bi-high-light,.bi-theme-dark .bi-list-item.disabled .bi-input,.bi-theme-dark .bi-list-item.disabled .bi-textarea,.bi-theme-dark .bi-list-item.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item.disabled:active .bi-input,.bi-theme-dark .bi-list-item.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item.disabled:hover .bi-input,.bi-theme-dark .bi-list-item.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-border.active,.bi-list-item-border:active{border:1px solid #178cdf}.bi-list-item-simple,.bi-list-item-simple .bi-input,.bi-list-item-simple .bi-textarea{color:#999}.bi-list-item-simple.hover,.bi-list-item-simple.hover .bi-input,.bi-list-item-simple.hover .bi-textarea,.bi-list-item-simple:hover,.bi-list-item-simple:hover .bi-input,.bi-list-item-simple:hover .bi-textarea{color:#3f8ce8}.bi-list-item-simple.disabled,.bi-list-item-simple.disabled .bi-high-light,.bi-list-item-simple.disabled .bi-input,.bi-list-item-simple.disabled .bi-textarea,.bi-list-item-simple.disabled:active,.bi-list-item-simple.disabled:active .bi-high-light,.bi-list-item-simple.disabled:active .bi-input,.bi-list-item-simple.disabled:active .bi-textarea,.bi-list-item-simple.disabled:hover,.bi-list-item-simple.disabled:hover .bi-high-light,.bi-list-item-simple.disabled:hover .bi-input,.bi-list-item-simple.disabled:hover .bi-textarea{color:#ccc!important}.bi-list-item-effect:hover,.bi-list-item-effect:hover .bi-input,.bi-list-item-effect:hover .bi-textarea{color:#1a1a1a}.bi-list-item-effect.active,.bi-list-item-effect.active .bi-input,.bi-list-item-effect.active .bi-textarea,.bi-list-item-effect:active,.bi-list-item-effect:active .bi-input,.bi-list-item-effect:active .bi-textarea{color:#3f8ce8}.bi-list-item-effect.disabled,.bi-list-item-effect.disabled .bi-high-light,.bi-list-item-effect.disabled .bi-input,.bi-list-item-effect.disabled .bi-textarea,.bi-list-item-effect.disabled:active,.bi-list-item-effect.disabled:active .bi-high-light,.bi-list-item-effect.disabled:active .bi-input,.bi-list-item-effect.disabled:active .bi-textarea,.bi-list-item-effect.disabled:hover,.bi-list-item-effect.disabled:hover .bi-high-light,.bi-list-item-effect.disabled:hover .bi-input,.bi-list-item-effect.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-effect:hover,.bi-theme-dark .bi-list-item-effect:hover .bi-input,.bi-theme-dark .bi-list-item-effect:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-effect.active,.bi-theme-dark .bi-list-item-effect.active .bi-input,.bi-theme-dark .bi-list-item-effect.active .bi-textarea,.bi-theme-dark .bi-list-item-effect:active,.bi-theme-dark .bi-list-item-effect:active .bi-input,.bi-theme-dark .bi-list-item-effect:active .bi-textarea{color:#3f8ce8}.bi-theme-dark .bi-list-item-effect.disabled,.bi-theme-dark .bi-list-item-effect.disabled:active,.bi-theme-dark .bi-list-item-effect.disabled:hover{background-color:transparent!important;color:#666!important}.bi-list-item-active.active,.bi-list-item-active.hover,.bi-list-item-active:active,.bi-list-item-active:hover{background-color:rgba(26,26,26,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a, endColorstr=#0d1a1a1a)}.bi-theme-dark .bi-list-item-effect.disabled .bi-high-light,.bi-theme-dark .bi-list-item-effect.disabled .bi-input,.bi-theme-dark .bi-list-item-effect.disabled .bi-textarea,.bi-theme-dark .bi-list-item-effect.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-effect.disabled:active .bi-input,.bi-theme-dark .bi-list-item-effect.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-active.hover,.bi-list-item-active.hover .bi-input,.bi-list-item-active.hover .bi-textarea,.bi-list-item-active:hover,.bi-list-item-active:hover .bi-input,.bi-list-item-active:hover .bi-textarea{color:#1a1a1a}.bi-list-item-active.active,.bi-list-item-active.active .bi-input,.bi-list-item-active.active .bi-textarea,.bi-list-item-active:active,.bi-list-item-active:active .bi-input,.bi-list-item-active:active .bi-textarea{color:#3f8ce8}.bi-list-item-active.disabled,.bi-list-item-active.disabled:active,.bi-list-item-active.disabled:hover{background-color:transparent!important;color:#ccc!important}.bi-list-item-active.disabled .bi-high-light,.bi-list-item-active.disabled .bi-input,.bi-list-item-active.disabled .bi-textarea,.bi-list-item-active.disabled:active .bi-high-light,.bi-list-item-active.disabled:active .bi-input,.bi-list-item-active.disabled:active .bi-textarea,.bi-list-item-active.disabled:hover .bi-high-light,.bi-list-item-active.disabled:hover .bi-input,.bi-list-item-active.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-active.hover,.bi-theme-dark .bi-list-item-active:hover{color:#fff;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item-active.hover .bi-input,.bi-theme-dark .bi-list-item-active.hover .bi-textarea,.bi-theme-dark .bi-list-item-active:hover .bi-input,.bi-theme-dark .bi-list-item-active:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-active.active,.bi-theme-dark .bi-list-item-active:active{color:#3f8ce8;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item-active.active .bi-input,.bi-theme-dark .bi-list-item-active.active .bi-textarea,.bi-theme-dark .bi-list-item-active:active .bi-input,.bi-theme-dark .bi-list-item-active:active .bi-textarea{color:#3f8ce8}.bi-theme-dark .bi-list-item-active.disabled,.bi-theme-dark .bi-list-item-active.disabled:active,.bi-theme-dark .bi-list-item-active.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-active.disabled .bi-high-light,.bi-theme-dark .bi-list-item-active.disabled .bi-input,.bi-theme-dark .bi-list-item-active.disabled .bi-textarea,.bi-theme-dark .bi-list-item-active.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-active.disabled:active .bi-input,.bi-theme-dark .bi-list-item-active.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-active.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-active.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-active.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-active2.hover,.bi-list-item-active2:hover{color:#1a1a1a;background-color:#fff}.bi-list-item-active2.hover .bi-input,.bi-list-item-active2.hover .bi-textarea,.bi-list-item-active2:hover .bi-input,.bi-list-item-active2:hover .bi-textarea{color:#1a1a1a}.bi-list-item-active2.active,.bi-list-item-active2:active{color:#3f8ce8;background-color:#fff}.bi-list-item-active2.active .bi-input,.bi-list-item-active2.active .bi-textarea,.bi-list-item-active2:active .bi-input,.bi-list-item-active2:active .bi-textarea{color:#3f8ce8}.bi-list-item-active2.disabled,.bi-list-item-active2.disabled:active,.bi-list-item-active2.disabled:hover{background-color:transparent!important;color:#ccc!important}.bi-list-item-active2.disabled .bi-high-light,.bi-list-item-active2.disabled .bi-input,.bi-list-item-active2.disabled .bi-textarea,.bi-list-item-active2.disabled:active .bi-high-light,.bi-list-item-active2.disabled:active .bi-input,.bi-list-item-active2.disabled:active .bi-textarea,.bi-list-item-active2.disabled:hover .bi-high-light,.bi-list-item-active2.disabled:hover .bi-input,.bi-list-item-active2.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-active2.hover,.bi-theme-dark .bi-list-item-active2:hover{color:#fff;background-color:#242640}.bi-theme-dark .bi-list-item-active2.hover .bi-input,.bi-theme-dark .bi-list-item-active2.hover .bi-textarea,.bi-theme-dark .bi-list-item-active2:hover .bi-input,.bi-theme-dark .bi-list-item-active2:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-active2.active,.bi-theme-dark .bi-list-item-active2:active{color:#3f8ce8;background-color:#242640}.bi-theme-dark .bi-list-item-active2.active .bi-input,.bi-theme-dark .bi-list-item-active2.active .bi-textarea,.bi-theme-dark .bi-list-item-active2:active .bi-input,.bi-theme-dark .bi-list-item-active2:active .bi-textarea{color:#3f8ce8}.bi-theme-dark .bi-list-item-active2.disabled,.bi-theme-dark .bi-list-item-active2.disabled:active,.bi-theme-dark .bi-list-item-active2.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-active2.disabled .bi-high-light,.bi-theme-dark .bi-list-item-active2.disabled .bi-input,.bi-theme-dark .bi-list-item-active2.disabled .bi-textarea,.bi-theme-dark .bi-list-item-active2.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-active2.disabled:active .bi-input,.bi-theme-dark .bi-list-item-active2.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-select.hover,.bi-list-item-select:hover{color:#1a1a1a;background-color:rgba(26,26,26,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a, endColorstr=#0d1a1a1a)}.bi-list-item-select.hover .bi-input,.bi-list-item-select.hover .bi-textarea,.bi-list-item-select:hover .bi-input,.bi-list-item-select:hover .bi-textarea{color:#1a1a1a}.bi-list-item-select.active,.bi-list-item-select:active{color:#fff;background-color:#3f8ce8}.bi-list-item-select.active .bi-high-light,.bi-list-item-select.active .bi-input,.bi-list-item-select.active .bi-textarea,.bi-list-item-select:active .bi-high-light,.bi-list-item-select:active .bi-input,.bi-list-item-select:active .bi-textarea{color:#fff}.bi-list-item-select.disabled,.bi-list-item-select.disabled:active,.bi-list-item-select.disabled:hover{color:#ccc!important;background-color:transparent!important}.bi-list-item-select.disabled .bi-high-light,.bi-list-item-select.disabled .bi-input,.bi-list-item-select.disabled .bi-textarea,.bi-list-item-select.disabled:active .bi-high-light,.bi-list-item-select.disabled:active .bi-input,.bi-list-item-select.disabled:active .bi-textarea,.bi-list-item-select.disabled:hover .bi-high-light,.bi-list-item-select.disabled:hover .bi-input,.bi-list-item-select.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-select.hover,.bi-theme-dark .bi-list-item-select:hover{color:#fff;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item-select.hover .bi-input,.bi-theme-dark .bi-list-item-select.hover .bi-textarea,.bi-theme-dark .bi-list-item-select:hover .bi-input,.bi-theme-dark .bi-list-item-select:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-select.active,.bi-theme-dark .bi-list-item-select:active{color:#fff;background-color:#3f8ce8}.bi-theme-dark .bi-list-item-select.active .bi-high-light,.bi-theme-dark .bi-list-item-select.active .bi-input,.bi-theme-dark .bi-list-item-select.active .bi-textarea,.bi-theme-dark .bi-list-item-select:active .bi-high-light,.bi-theme-dark .bi-list-item-select:active .bi-input,.bi-theme-dark .bi-list-item-select:active .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-select.disabled,.bi-theme-dark .bi-list-item-select.disabled:active,.bi-theme-dark .bi-list-item-select.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-select.disabled .bi-high-light,.bi-theme-dark .bi-list-item-select.disabled .bi-input,.bi-theme-dark .bi-list-item-select.disabled .bi-textarea,.bi-theme-dark .bi-list-item-select.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-select.disabled:active .bi-input,.bi-theme-dark .bi-list-item-select.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-select.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-select.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-select.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-none.hover,.bi-list-item-none:hover{color:inherit;background-color:transparent}.bi-list-item-none.hover .bi-input,.bi-list-item-none.hover .bi-textarea,.bi-list-item-none:hover .bi-input,.bi-list-item-none:hover .bi-textarea{color:inherit}.bi-list-item-none.active,.bi-list-item-none:active{color:inherit;background-color:transparent}.bi-list-item-none.active .bi-high-light,.bi-list-item-none.active .bi-input,.bi-list-item-none.active .bi-textarea,.bi-list-item-none:active .bi-high-light,.bi-list-item-none:active .bi-input,.bi-list-item-none:active .bi-textarea{color:inherit}.bi-list-item-none.disabled,.bi-list-item-none.disabled:active,.bi-list-item-none.disabled:hover{color:#ccc!important;background-color:transparent!important}.bi-list-item-none.disabled .bi-high-light,.bi-list-item-none.disabled .bi-input,.bi-list-item-none.disabled .bi-textarea,.bi-list-item-none.disabled:active .bi-high-light,.bi-list-item-none.disabled:active .bi-input,.bi-list-item-none.disabled:active .bi-textarea,.bi-list-item-none.disabled:hover .bi-high-light,.bi-list-item-none.disabled:hover .bi-input,.bi-list-item-none.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-none.hover,.bi-theme-dark .bi-list-item-none:hover{color:inherit;background-color:transparent}.bi-theme-dark .bi-list-item-none.hover .bi-input,.bi-theme-dark .bi-list-item-none.hover .bi-textarea,.bi-theme-dark .bi-list-item-none:hover .bi-input,.bi-theme-dark .bi-list-item-none:hover .bi-textarea{color:inherit}.bi-theme-dark .bi-list-item-none.active,.bi-theme-dark .bi-list-item-none:active{color:inherit;background-color:transparent}.bi-theme-dark .bi-list-item-none.active .bi-high-light,.bi-theme-dark .bi-list-item-none.active .bi-input,.bi-theme-dark .bi-list-item-none.active .bi-textarea,.bi-theme-dark .bi-list-item-none:active .bi-high-light,.bi-theme-dark .bi-list-item-none:active .bi-input,.bi-theme-dark .bi-list-item-none:active .bi-textarea{color:inherit}.bi-theme-dark .bi-list-item-none.disabled,.bi-theme-dark .bi-list-item-none.disabled:active,.bi-theme-dark .bi-list-item-none.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-none.disabled .bi-high-light,.bi-theme-dark .bi-list-item-none.disabled .bi-input,.bi-theme-dark .bi-list-item-none.disabled .bi-textarea,.bi-theme-dark .bi-list-item-none.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-none.disabled:active .bi-input,.bi-theme-dark .bi-list-item-none.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-none.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-none.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-none.disabled:hover .bi-textarea{color:#666!important}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.cursor-move{cursor:move}.y-overflow-auto{overflow-y:auto;overflow-x:hidden}.x-overflow-auto{overflow-y:hidden;overflow-x:auto}.y-overflow-scroll{overflow-y:scroll;overflow-x:hidden}.x-overflow-scroll{overflow-y:hidden;overflow-x:scroll}.overflow-auto{overflow-x:auto;overflow-y:auto}.overflow-scroll{overflow-x:scroll;overflow-y:scroll}.overflow-dot,.overflow-hidden{overflow-x:hidden;overflow-y:hidden}.td-overflow{white-space:normal;word-break:break-all}.overflow-dot{white-space:nowrap}.display-block{display:block}.display-inline{display:inline-block}.vertical-super{vertical-align:super}.vertical-top{vertical-align:top}.horizon-center{text-align:center}.horizon-left{text-align:left}.border-sizing{-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.content-sizing{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;-ms-box-sizing:content-box;box-sizing:content-box}.bi-flex-center-layout{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center}.bi-flex-horizontal-layout{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:flex-start;-webkit-align-items:flex-start;-moz-align-items:flex-start;-ms-align-items:flex-start;-o-align-items:flex-start;align-items:flex-start;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap}.bi-flex-horizontal-layout.middle{-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center}.bi-flex-horizontal-layout.bottom{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-moz-align-items:flex-end;-ms-align-items:flex-end;-o-align-items:flex-end;align-items:flex-end}.bi-flex-vertical-center{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap}.bi-flex-vertical-center.stretch{-webkit-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;-o-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;-ms-align-items:stretch;-o-align-items:stretch;align-items:stretch}.bi-flex-wrapper-center-layout .flex-wrapper-center-layout-wrapper{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;min-width:100%;min-height:100%;float:left}.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:flex-start;-webkit-align-items:flex-start;-moz-align-items:flex-start;-ms-align-items:flex-start;-o-align-items:flex-start;align-items:flex-start;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap;min-height:100%}.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.middle{-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center}.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.bottom{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-moz-align-items:flex-end;-ms-align-items:flex-end;-o-align-items:flex-end;align-items:flex-end}.bi-flex-wrapper-vertical-center .flex-wrapper-vertical-center-wrapper{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap;min-height:100%;float:left}.bi-flex-wrapper-vertical-center .flex-wrapper-vertical-center-wrapper.stretch{width:100%;-webkit-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;-o-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;-ms-align-items:stretch;-o-align-items:stretch;align-items:stretch}.bi-inline-center-adapt-layout:after,.bi-inline-vertical-adapt-layout:after{display:inline-block;width:0;min-height:100%;vertical-align:middle;content:' '}.cm-tab-wrap-hack:after,.scrollbar-layout-face:after{content:''}.bi-theme-dark{background-color:#191b2b;color:#ccc}.bi-theme-dark .bi-input{color:#fff}.bi-color-chooser-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;box-shadow:0 0 2px 1px #d4dadd inset;-webkit-box-shadow:0 0 2px 1px #d4dadd inset;-moz-box-shadow:0 0 2px 1px #d4dadd inset}.bi-color-picker-button .color-picker-button-mask{border:1px solid #1a1a1a}.bi-theme-dark .bi-color-picker-button .color-picker-button-mask{border:1px solid #fff}.bi-color-picker-editor .color-picker-editor-display{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;box-shadow:0 0 2px 1px #d4dadd inset;-webkit-box-shadow:0 0 2px 1px #d4dadd inset;-moz-box-shadow:0 0 2px 1px #d4dadd inset}.farbtastic{position:relative}.farbtastic *{position:absolute;cursor:crosshair}.farbtastic,.farbtastic .wheel{width:195px;height:195px}.farbtastic .color,.farbtastic .overlay{top:47px;left:47px;width:101px;height:101px}.farbtastic .wheel{width:195px;height:195px}.farbtastic .marker{width:17px;height:17px;margin:-8px 0 0 -8px;overflow:hidden}.bi-bubble-combo .bubble-combo-triangle-left,.bi-bubble-combo .bubble-combo-triangle-right{z-index:1;width:0;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent}.bi-bubble-combo .button-combo-triangle-wrapper{position:fixed!important}.bi-bubble-combo .bubble-combo-triangle-left{border-left:6px solid #3f8ce8}.bi-bubble-combo .bubble-combo-triangle-right{border-right:6px solid #3f8ce8}.bi-bubble-combo .bubble-combo-triangle-bottom,.bi-bubble-combo .bubble-combo-triangle-top{width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;z-index:1}.bi-bubble-combo .bubble-combo-triangle-top{border-top:6px solid #3f8ce8}.bi-bubble-combo .bubble-combo-triangle-bottom{border-bottom:6px solid #3f8ce8}.bi-bubble-popup-view{-webkit-box-shadow:0 0 10px rgba(0,0,0,.2);-moz-box-shadow:0 0 10px rgba(0,0,0,.2);box-shadow:0 0 10px rgba(0,0,0,.2)}.bi-adapt-editor .adapt-editor-text{font-size:14px}.bi-search-editor .close-font,.bi-search-editor .search-font{font-size:20px}.bi-small-search-editor .bi-editor,.bi-small-search-editor .bi-editor .bi-input,.bi-small-search-editor .bi-editor .bi-label{font-size:12px}.bi-small-search-editor .close-font,.bi-small-search-editor .search-font{font-size:18px}.bi-sign-initial-editor .sign-initial-editor-text{font-size:14px}.CodeMirror{font-family:monospace;cursor:text;width:100%;height:100%}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #1a1a1a}.bi-theme-dark .CodeMirror div.CodeMirror-cursor{border-left:1px solid #fff}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.CodeMirror.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}@-moz-keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}@-webkit-keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}@keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.bi-display-tree .ztree li a:hover,.ztree li a{text-decoration:none}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default span[class*=fieldName]{display:inline-block;color:#fff;background:#3f8ce8;padding:0 5px;margin:1px}.cm-s-default span[class*=start]{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;margin-left:3px}.cm-s-default span[class*=end]{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;margin-right:3px}.cm-s-default span[class*="start end"]{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.cm-s-default span[class*="#"]{color:#3f8ce8}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none}.bi-message-text,.bi-page-table-cell{-webkit-user-select:text;-moz-user-select:text;-o-user-select:text;-khtml-user-select:text}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}.codemirror-high-line-height{line-height:2}.codemirror-low-line-height{line-height:1.4}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.bi-collection-table-cell,.bi-text{-webkit-box-sizing:border-box;-ms-box-sizing:border-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:none;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}span.CodeMirror-selectedtext{background:0 0}.CodeMirror-hints{position:absolute;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto;z-index:1000000000}.bi-label,.bi-segment>.center-element,.bi-text,.bi-textarea-editor{overflow-x:hidden;overflow-y:hidden}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;max-width:19em;overflow:hidden;white-space:pre;color:#000;cursor:pointer}.bi-label,.bi-text,.ztree li{white-space:nowrap}li.CodeMirror-hint-active{background:#08f;color:#fff}.bi-message-title{font-size:16px;cursor:pointer}.bi-message-text{font-size:16px;-ms-user-select:text;user-select:text}.bi-message-content{font-size:16px}.bi-message-close{font-size:25px}.bi-multi-list-view .bi-button-mask{opacity:.1;filter:alpha(opacity=10)}.bi-panel{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-panel .panel-title .panel-title-text{cursor:text;font-size:14px}.bi-all-count-pager .all-pager-next,.bi-all-count-pager .all-pager-prev,.bi-direction-pager .direction-pager-next,.bi-direction-pager .direction-pager-prev,.bi-rich-editor-text-toolbar .text-toolbar-button{font-size:16px}.bi-pager .page-item{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-segment>.center-element{overflow:hidden;background:#fff;border-right:1px solid #d4dadd;border-top:1px solid #d4dadd;border-bottom:1px solid #d4dadd}.bi-segment>.first-element{border-left:1px solid #d4dadd;-webkit-border-radius:6px 0 0 6px;-moz-border-radius:6px 0 0 6px;border-radius:6px 0 0 6px}.bi-segment>.last-element{-webkit-border-radius:0 6px 6px 0;-moz-border-radius:0 6px 6px 0;border-radius:0 6px 6px 0}.bi-theme-dark .bi-segment>.center-element{overflow:hidden;overflow-x:hidden;overflow-y:hidden;background:#242640;border-right:1px solid #525466;border-top:1px solid #525466;border-bottom:1px solid #525466}.bi-theme-dark .bi-segment>.first-element{border-left:1px solid #242640}#body .bi-button,body .bi-button{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;border:1px solid #178cdf;background-color:#3f8ce8;text-align:center;vertical-align:middle;cursor:pointer;font-size:14px}#body .bi-button.block,body .bi-button.block{font-size:inherit;border-width:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}#body .bi-button.clear,body .bi-button.clear{font-size:inherit;border-width:0;background-color:transparent}#body .bi-button.clear:active,#body .bi-button.clear:hover,body .bi-button.clear:active,body .bi-button.clear:hover{opacity:.75;filter:alpha(opacity=75)}#body .bi-button.button-common,#body .bi-button.button-common .b-font:before,body .bi-button.button-common,body .bi-button.button-common .b-font:before{color:#fff}#body .bi-button.button-common.clear,#body .bi-button.button-common.clear .b-font:before,body .bi-button.button-common.clear,body .bi-button.button-common.clear .b-font:before{color:#3f8ce8}#body .bi-button.button-ignore,body .bi-button.button-ignore{background-color:#fff;border-color:#d4dadd}#body .bi-button.button-ignore,#body .bi-button.button-ignore .b-font:before,body .bi-button.button-ignore,body .bi-button.button-ignore .b-font:before{color:#1a1a1a}#body .bi-button.button-ignore.clear,body .bi-button.button-ignore.clear{background-color:transparent;border-width:0}#body .bi-button.button-success,body .bi-button.button-success{background-color:#58cc7d;border-color:#58cc7d}#body .bi-button.button-success,#body .bi-button.button-success .b-font:before,body .bi-button.button-success,body .bi-button.button-success .b-font:before{color:#fff}#body .bi-button.button-success.clear,body .bi-button.button-success.clear{background-color:transparent;border-width:0}#body .bi-button.button-success.clear,#body .bi-button.button-success.clear .b-font:before,body .bi-button.button-success.clear,body .bi-button.button-success.clear .b-font:before{color:#0c6d23}#body .bi-button.button-warning,body .bi-button.button-warning{background-color:#e85050;border-color:#e85050}#body .bi-button.button-warning,#body .bi-button.button-warning .b-font:before,body .bi-button.button-warning,body .bi-button.button-warning .b-font:before{color:#fff}#body .bi-button.button-warning.clear,body .bi-button.button-warning.clear{background-color:transparent;border-width:0}#body .bi-button.button-warning.clear,#body .bi-button.button-warning.clear .b-font:before,body .bi-button.button-warning.clear,body .bi-button.button-warning.clear .b-font:before{color:#e85050}#body .bi-button.button-common.disabled,#body .bi-button.button-common.disabled.base-disabled,#body .bi-button.button-success.disabled,#body .bi-button.button-success.disabled.base-disabled,#body .bi-button.button-warning.disabled,#body .bi-button.button-warning.disabled.base-disabled,body .bi-button.button-common.disabled,body .bi-button.button-common.disabled.base-disabled,body .bi-button.button-success.disabled,body .bi-button.button-success.disabled.base-disabled,body .bi-button.button-warning.disabled,body .bi-button.button-warning.disabled.base-disabled{background:#ccc!important;border-color:#ccc!important}#body .bi-button.button-common.disabled,#body .bi-button.button-common.disabled .b-font:before,#body .bi-button.button-common.disabled.base-disabled,#body .bi-button.button-common.disabled.base-disabled .b-font:before,#body .bi-button.button-success.disabled,#body .bi-button.button-success.disabled .b-font:before,#body .bi-button.button-success.disabled.base-disabled,#body .bi-button.button-success.disabled.base-disabled .b-font:before,#body .bi-button.button-warning.disabled,#body .bi-button.button-warning.disabled .b-font:before,#body .bi-button.button-warning.disabled.base-disabled,#body .bi-button.button-warning.disabled.base-disabled .b-font:before,body .bi-button.button-common.disabled,body .bi-button.button-common.disabled .b-font:before,body .bi-button.button-common.disabled.base-disabled,body .bi-button.button-common.disabled.base-disabled .b-font:before,body .bi-button.button-success.disabled,body .bi-button.button-success.disabled .b-font:before,body .bi-button.button-success.disabled.base-disabled,body .bi-button.button-success.disabled.base-disabled .b-font:before,body .bi-button.button-warning.disabled,body .bi-button.button-warning.disabled .b-font:before,body .bi-button.button-warning.disabled.base-disabled,body .bi-button.button-warning.disabled.base-disabled .b-font:before{color:#fff!important}#body .bi-button.button-common.disabled.clear,#body .bi-button.button-common.disabled.clear .b-font:before,#body .bi-button.button-ignore.disabled,#body .bi-button.button-ignore.disabled .b-font:before,#body .bi-button.button-ignore.disabled.clear,#body .bi-button.button-ignore.disabled.clear .b-font:before,#body .bi-button.button-success.disabled.clear,#body .bi-button.button-success.disabled.clear .b-font:before,#body .bi-button.button-warning.disabled.clear,#body .bi-button.button-warning.disabled.clear .b-font:before,body .bi-button.button-common.disabled.clear,body .bi-button.button-common.disabled.clear .b-font:before,body .bi-button.button-ignore.disabled,body .bi-button.button-ignore.disabled .b-font:before,body .bi-button.button-ignore.disabled.clear,body .bi-button.button-ignore.disabled.clear .b-font:before,body .bi-button.button-success.disabled.clear,body .bi-button.button-success.disabled.clear .b-font:before,body .bi-button.button-warning.disabled.clear,body .bi-button.button-warning.disabled.clear .b-font:before{color:#ccc!important}#body .bi-button.button-ignore.disabled,body .bi-button.button-ignore.disabled{background:#fff!important;border-color:#d4dadd!important}#body .bi-button.button-common.disabled.clear,#body .bi-button.button-ignore.disabled.clear,#body .bi-button.button-success.disabled.clear,#body .bi-button.button-warning.disabled.clear,body .bi-button.button-common.disabled.clear,body .bi-button.button-ignore.disabled.clear,body .bi-button.button-success.disabled.clear,body .bi-button.button-warning.disabled.clear{background:0 0!important;border-width:0!important}#body .bi-button.button-common.disabled.clear:active,#body .bi-button.button-common.disabled.clear:hover,#body .bi-button.button-ignore.disabled.clear:active,#body .bi-button.button-ignore.disabled.clear:hover,#body .bi-button.button-success.disabled.clear:active,#body .bi-button.button-success.disabled.clear:hover,#body .bi-button.button-warning.disabled.clear:active,#body .bi-button.button-warning.disabled.clear:hover,body .bi-button.button-common.disabled.clear:active,body .bi-button.button-common.disabled.clear:hover,body .bi-button.button-ignore.disabled.clear:active,body .bi-button.button-ignore.disabled.clear:hover,body .bi-button.button-success.disabled.clear:active,body .bi-button.button-success.disabled.clear:hover,body .bi-button.button-warning.disabled.clear:active,body .bi-button.button-warning.disabled.clear:hover{opacity:1;filter:alpha(opacity=100)}.bi-basic-button.button-common .bi-button-mask,.bi-basic-button.button-success .bi-button-mask,.bi-basic-button.button-warning .bi-button-mask{opacity:.2;filter:alpha(opacity=20);background-color:#fff}.bi-basic-button .bi-button-mask{opacity:.2;filter:alpha(opacity=20);background-color:#1a1a1a}.bi-single-select-icon-text-item.active .b-font:before,.bi-single-select-icon-text-item:active .b-font:before{color:#3f8ce8}.bi-code-editor .param{color:#fff;padding:0 5px;margin:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#3f8ce8;display:inline-block}.bi-code-editor .error-param{color:#e85050;padding:0 5px;margin:1px;display:inline-block}.bi-editor{font-size:12px}.bi-multifile-editor .multifile-editor{text-align:right;cursor:pointer;font-size:100px;z-index:2}.bi-resizable-table .resizable-table-region-resizer,.bi-resizable-table-cell .resizable-table-cell-resizer-container{cursor:ew-resize;z-index:1}.bi-shelter-editor .shelter-editor-text,.bi-sign-editor .sign-editor-text{font-size:12px}.bi-textarea-editor{overflow:hidden}.bi-textarea-editor .textarea-editor-content{font-size:12px;border:none}.bi-bubble,.bi-toast{font-size:14px}.bi-file{opacity:0;filter:alpha(opacity=0);z-index:2}.bi-input,.bi-textarea{border:none;outline:0;background-color:transparent;padding:0;margin:0;width:100%;height:100%}.bi-input.bi-input-focus,.bi-textarea.bi-input-focus{border:none}.bi-input.bi-input-error,.bi-textarea.bi-input-error{border:none;color:#e85050!important}.bi-bubble .bubble-text,.bi-toast{-webkit-border-radius:2px;-moz-border-radius:2px}.bi-label{word-break:break-all}.bi-text{box-sizing:border-box;word-wrap:break-word;word-break:break-word}.bi-bubble .bubble-text{border-radius:2px;background:#fddddd;color:#e85050}.bi-tip{position:fixed!important}.bi-toast{border-radius:2px}.bi-toast.toast-success{background:#e1f4e7;color:#0c6d23}.bi-toast.toast-warning{background:#fddddd;color:#e85050}.bi-tooltip{max-width:250px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;font-size:12px}.bi-tooltip.tooltip-success{background:#fff5c1;border:1px solid #fff5c1;color:#1a1a1a}.bi-tooltip.tooltip-warning{background:#fddddd;color:#e85050;border:1px solid #f4cbcb}.bi-table>div.bottom-left>div>div>table,.bi-table>div.bottom-right>div>div>table,.bi-table>div.top-left>div>div>table,.bi-table>div.top-right>div>div>table,.bi-table>div>div>table{border-right:1px solid #d4dadd;border-bottom:1px solid #d4dadd}.bi-collection-table-cell{box-sizing:border-box}.bi-grid-table-cell,.bi-sequence-table-dynamic-number .sequence-table-title-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box}.bi-collection-table-cell.first-row{border-top:1px solid #d4dadd}.bi-collection-table-cell.first-col{border-left:1px solid #d4dadd}.bi-theme-dark .bi-collection-table-cell.first-row{border-top:1px solid #525466}.bi-theme-dark .bi-collection-table-cell.first-col{border-left:1px solid #525466}.bi-quick-collection-table>div>.bi-collection{overflow:hidden!important;overflow-x:hidden!important;overflow-y:hidden!important}.bi-table>.first-col{border-left:none}.bi-table>.first-row{border-top:none}.bi-theme-dark .bi-table>div.bottom-left>div>div>table,.bi-theme-dark .bi-table>div.bottom-right>div>div>table,.bi-theme-dark .bi-table>div.top-left>div>div>table,.bi-theme-dark .bi-table>div.top-right>div>div>table,.bi-theme-dark .bi-table>div>div>table{border-right:1px solid #525466;border-bottom:1px solid #525466}.bi-table>div>div>div>table,.bi-table>div>div>table{min-width:100%;clear:both;border-spacing:0;border-collapse:separate}.bi-table>div>div>div>table,.bi-table>div>div>div>table>*>*>td,.bi-table>div>div>div>table>*>*>th,.bi-table>div>div>table,.bi-table>div>div>table>*>*>td,.bi-table>div>div>table>*>*>th{vertical-align:middle;margin:0;padding:0}.bi-table>div>div>div>table>tbody>tr>td,.bi-table>div>div>div>table>thead>tr>td,.bi-table>div>div>table>tbody>tr>td,.bi-table>div>div>table>thead>tr>td{border-top:1px solid #d4dadd;border-left:1px solid #d4dadd}.bi-theme-dark .bi-table>div>div>div>table>tbody>tr>td,.bi-theme-dark .bi-table>div>div>div>table>thead>tr>td,.bi-theme-dark .bi-table>div>div>table>tbody>tr>td,.bi-theme-dark .bi-table>div>div>table>thead>tr>td{border-top:1px solid #525466;border-left:1px solid #525466}.bi-grid-table-cell{box-sizing:border-box}.bi-grid-table-cell.first-row{border-top:1px solid #d4dadd}.bi-grid-table-cell.first-col{border-left:1px solid #d4dadd}.bi-theme-dark .bi-grid-table-cell.first-row{border-top:1px solid #525466}.bi-theme-dark .bi-grid-table-cell.first-col{border-left:1px solid #525466}.scrollbar-layout-main{box-sizing:border-box;outline:0;overflow:hidden;position:absolute;transition-duration:250ms;transition-timing-function:ease;user-select:none;background-color:rgba(102,102,102,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666, endColorstr=#0d666666);border-radius:5px}.bi-theme-dark .scrollbar-layout-main{background-color:rgba(204,204,204,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc, endColorstr=#0dcccccc)}.scrollbar-layout-main-vertical{bottom:0;right:0;top:0;transition-property:background-color;width:10px}.scrollbar-layout-main-vertical.public-scrollbar-main-active,.scrollbar-layout-main-vertical:hover{width:10px}.scrollbar-layout-main-horizontal{bottom:0;height:10px;left:0;transition-property:background-color;background-color:rgba(102,102,102,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666, endColorstr=#0d666666)}.bi-theme-dark .scrollbar-layout-main-horizontal{background-color:rgba(204,204,204,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc, endColorstr=#0dcccccc)}.scrollbar-layout-main-horizontal.public-scrollbar-main-active,.scrollbar-layout-main-horizontal:hover{height:10px}.scrollbar-layout-face{left:0;overflow:hidden;position:absolute;z-index:1}.scrollbar-layout-face:after{border-radius:6px;display:block;position:absolute;transition:background-color 250ms ease}.scrollbar-layout-face-horizontal{bottom:0;left:0;top:0}.scrollbar-layout-face-horizontal:after{bottom:2px;left:0;top:2px;width:100%}.scrollbar-layout-face-vertical{left:0;right:0;top:0}.scrollbar-layout-face-vertical:after{height:100%;left:2px;right:2px;top:0}.public-scrollbar-face:after{background-color:rgba(102,102,102,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666, endColorstr=#4d666666)}.bi-theme-dark .public-scrollbar-face:after{background-color:rgba(204,204,204,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc, endColorstr=#4dcccccc)}.public-scrollbar-face-active:after,.public-scrollbar-main-active .public-scrollbar-face:after,.public-scrollbar-main:hover .public-scrollbar-face:after{background-color:rgba(102,102,102,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666, endColorstr=#b3666666)}.bi-theme-dark .public-scrollbar-face-active:after,.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after{background-color:rgba(204,204,204,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc, endColorstr=#b3cccccc)}.horizontal-scrollbar{bottom:0;position:absolute}.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob,.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob{background-color:#3f8ce8}.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob{background-color:#58cc7d}.bi-resizable-table .resizable-table-resizer{cursor:ew-resize;z-index:1;background-color:#3f8ce8}.bi-resizable-table .resizable-table-resizer.suitable{background-color:#58cc7d}.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob,.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob{background-color:#3f8ce8}.bi-branch-tree .bi-branch-tree-view{min-width:300px}.bi-display-tree .ztree *{color:#999}.bi-display-tree .ztree li a,.bi-display-tree .ztree li span{cursor:default!important}.ztree li a,.ztree li span.button{cursor:pointer;display:inline-block}.bi-display-tree .ztree li a.curSelectedNode{padding-top:1px;border:none;background-color:inherit;opacity:1;filter:alpha(opacity=100)}.ztree li a.tmpTargetNode_inner,ul.tmpTargetzTree,ul.ztree.zTreeDragUL{opacity:.8;filter:alpha(opacity=80)}.ztree *{padding:0;margin:0}.ztree{margin:0;padding:5px}.ztree li{padding:0;margin:0;list-style:none;line-height:14px;text-align:left;outline:0}.ztree li ul{margin:0;padding:0 0 0 18px}.ztree li a{padding:1px 3px 0 0;margin:0;height:24px;background-color:transparent;vertical-align:top}.ztree li a.curSelectedNode_Edit{padding-top:0;background-color:#FFE6B0;color:#000;height:16px;border:1px solid #FFB951;opacity:.8}.ztree li a.tmpTargetNode_inner{padding-top:0;background-color:#316AC5;color:#fff;height:16px;border:1px solid #316AC5}.ztree li a input.rename{height:14px;width:80px;padding:0;margin:0;font-size:12px;border:1px solid #7EC4CC}.ztree li span{line-height:24px;margin-right:2px}.ztree li span.button{line-height:0;margin:0;width:16px;height:16px;vertical-align:middle;border:0;outline:0;background-color:transparent;background-repeat:no-repeat;background-attachment:scroll}.bi-popup-view .list-view-toolbar,.bi-year-popup .year-popup-navigation{line-height:30px}.ztree li span.button.chk{width:16px;height:16px;margin:0 3px 0 0;cursor:auto}.ztree li span.button.chk.checkbox_false_disable{background-position:0 -56px}.ztree li span.button.chk.checkbox_true_disable{background-position:-14px -56px}.ztree li span.button.chk.radio_false_full{background-position:-28px 0}.ztree li span.button.chk.radio_false_full_focus{background-position:-28px -14px}.ztree li span.button.chk.radio_false_part{background-position:-28px -28px}.ztree li span.button.chk.radio_false_part_focus{background-position:-28px -42px}.ztree li span.button.chk.radio_false_disable{background-position:-28px -56px}.ztree li span.button.chk.radio_true_full{background-position:-42px 0}.ztree li span.button.chk.radio_true_full_focus{background-position:-42px -14px}.ztree li span.button.chk.radio_true_part{background-position:-42px -28px}.ztree li span.button.chk.radio_true_part_focus{background-position:-42px -42px}.ztree li span.button.chk.radio_true_disable{background-position:-42px -56px}.ztree li span.button.switch{width:25px;height:25px}.ztree li span.button.noline_open{background-position:-92px -72px}.ztree li span.button.noline_close{background-position:-74px -72px}.ztree li span.button.noline_docu,.ztree li span.button.root_docu{background:0 0}.ztree li span.button.ico_open{margin-right:2px;background-position:-110px -16px;vertical-align:top}.ztree li span.button.ico_close{margin-right:2px;background-position:-110px 0;vertical-align:top}.ztree li span.button.ico_docu{margin-right:2px;background-position:-110px -32px;vertical-align:top}.ztree li span.button.edit{margin-right:2px;background-position:-110px -48px;vertical-align:top}.ztree li span.button.remove{margin-right:2px;background-position:-110px -64px;vertical-align:top}.ztree li span.button.ico_loading{width:0;margin-right:2px;vertical-align:top}ul.tmpTargetzTree{background-color:#FFE6B0}span.tmpzTreeMove_arrow{width:16px;height:16px;display:inline-block;padding:0;margin:2px 0 0 1px;border:0;position:absolute;background-color:transparent;background-repeat:no-repeat;background-attachment:scroll;background-position:-110px -80px}.zTreeMask,ul.ztree.zTreeDragUL{background-color:#cfcfcf;position:absolute}ul.ztree.zTreeDragUL{margin:0;padding:0;width:auto;height:auto;overflow:hidden;border:1px dotted #00B83F}body,html{height:100%}.zTreeMask{z-index:10000;opacity:0;filter:alpha(opacity=0)}.bi-trigger .bi-trigger-icon-button{font-size:16px}.bi-select-text-trigger,.bi-small-select-text-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-date-trigger,.bi-popup-view .list-view-outer{-webkit-border-radius:2px;-moz-border-radius:2px}.bi-popup-view{position:fixed!important;overflow-y:visible!important;overflow-x:visible!important;overflow:visible!important;cursor:default}.bi-popup-view .list-view-outer{border-radius:2px}.bi-popup-view .list-view-toolbar>.center-element{border-left:1px solid #d4dadd}.bi-popup-view .list-view-toolbar>.first-element{border-left:none}.bi-theme-dark .bi-popup-view .list-view-toolbar>.center-element{border-left:1px solid #525466}.bi-theme-dark .bi-popup-view .list-view-toolbar>.first-element{border-left:none}.bi-arrangement .arrangement-helper{background:#3f8ce8;z-index:1000000000}.bi-arrangement .arrangement-block,.bi-arrangement .arrangement-drop-container{z-index:1000000000}.bi-arrangement .arrangement-drop-container .arrangement-drop-region{overflow:hidden}.bi-arrangement .arrangement-drop-container .bottom-center,.bi-arrangement .arrangement-drop-container .bottom-center-second,.bi-arrangement .arrangement-drop-container .bottom-left,.bi-arrangement .arrangement-drop-container .bottom-left-second,.bi-arrangement .arrangement-drop-container .bottom-right,.bi-arrangement .arrangement-drop-container .bottom-right-second,.bi-arrangement .arrangement-drop-container .drop-devider,.bi-arrangement .arrangement-drop-container .left-center,.bi-arrangement .arrangement-drop-container .left-center-second,.bi-arrangement .arrangement-drop-container .right-center,.bi-arrangement .arrangement-drop-container .right-center-second,.bi-arrangement .arrangement-drop-container .top-center,.bi-arrangement .arrangement-drop-container .top-center-second,.bi-arrangement .arrangement-drop-container .top-left,.bi-arrangement .arrangement-drop-container .top-left-second,.bi-arrangement .arrangement-drop-container .top-right,.bi-arrangement .arrangement-drop-container .top-right-second{z-index:1000000001;background:#3f8ce8}.bi-arrangement-droppable{z-index:100000}.bi-date-trigger{border-radius:2px}.bi-down-list-popup .bi-down-list-item .list-item-text,.bi-down-list-popup .list-group-item-text{max-width:203px}.bi-excel-table>div.bottom-right>div>div>table{border-right:1px solid #d4dadd}.bi-theme-dark .bi-excel-table>div.bottom-right>div>div>table{border-right:1px solid #525466}.bi-file-manager-nav-button .file-manager-nav-button-text{max-width:200px}.bi-file-manager-nav-button .file-manager-nav-button-text.active{background-color:#eff1f4;color:#999}.bi-file-manager-nav-button .file-manager-nav-button-triangle{z-index:1}.bi-theme-dark .bi-file-manager-nav-button .file-manager-nav-button-text.active{background-color:#191b2b;color:#999}.bi-interactive-arrangement .interactive-arrangement-dragtag-line{z-index:1000000000;background-color:#f07d0a}.bi-interactive-arrangement .interactive-arrangement-dragtag-icon{z-index:1000000000}.bi-month-trigger,.bi-multidate-combo{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-multidate-popup .multidate-popup-label{color:#3f8ce8;font-size:14px}.bi-multidate-popup .multidate-popup-item.active,.bi-multidate-popup .multidate-popup-item:active{background-color:#3f8ce8;color:#fff;-webkit-border-radius:2px 2px 0 0;-moz-border-radius:2px 2px 0 0;border-radius:2px 2px 0 0}.bi-multidate-popup .multidate-popup-button{color:#3f8ce8;font-size:14px}.bi-multidate-segment .bi-multidate-editor{font-size:14px}.bi-multi-select-combo .multi-select-trigger-icon-button,.bi-multi-select-insert-combo .multi-select-trigger-icon-button,.bi-multi-tree-combo .multi-select-trigger-icon-button{font-size:16px}.bi-multi-select-check-pane .multi-select-check-selected{text-decoration:underline}.bi-multi-select-trigger{-webkit-border-radius:2px 2px 2px 2px;-moz-border-radius:2px;border-radius:2px}.bi-multi-select-search-pane .multi-select-toolbar{color:#e85050}.bi-multi-select-check-selected-button{z-index:1}.bi-multi-tree-check-pane .multi-tree-check-selected{color:#3f8ce8}.bi-number-interval .number-interval-big-combo .bi-icon-combo-trigger .icon-combo-trigger-icon,.bi-number-interval .number-interval-small-combo .bi-icon-combo-trigger .icon-combo-trigger-icon{font-size:14px}.bi-multi-tree-popup .popup-view-tree{min-height:170px}.bi-preview-table-cell,.bi-preview-table-header-cell{min-height:25px;min-width:80px;max-width:220px}.bi-multi-tree-check-selected-button .trigger-check-selected{color:#3f8ce8;z-index:1}.bi-number-editor{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-number-interval .number-interval-small-editor{-moz-border-radius-topleft:2px;-webkit-border-top-left-radius:2px;-moz-border-radius-bottomleft:2px;-webkit-border-bottom-left-radius:2px;border-top-left-radius:2px;border-bottom-left-radius:2px}.bi-number-interval .number-interval-big-editor{-moz-border-radius-topright:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-bottomright:2px;-webkit-border-bottom-right-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px}.bi-number-interval .number-interval-big-combo{-moz-border-radius-topleft:2px;-webkit-border-top-left-radius:2px;-moz-border-radius-bottomleft:2px;-webkit-border-bottom-left-radius:2px;border-top-left-radius:2px;border-bottom-left-radius:2px}.bi-number-interval .number-interval-small-combo{-moz-border-radius-topright:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-bottomright:2px;-webkit-border-bottom-right-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px}.bi-number-interval.number-error .bi-input{color:#e85050!important}.bi-page-table-cell{-ms-user-select:text;user-select:text}.bi-path-chooser .path-chooser-radio,.bi-path-region .path-region-label{z-index:1}.bi-preview-table{-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;-o-user-select:text;user-select:text}.bi-preview-table>div>div>div>table>thead>tr.odd,.bi-preview-table>div>table>thead>tr.odd{background-color:#eff1f4}.bi-theme-dark .bi-preview-table>div>div>div>table>thead>tr.odd,.bi-theme-dark .bi-preview-table>div>table>thead>tr.odd{background-color:#191b2b}.bi-quarter-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-relation-view-region .relation-view-region-container{z-index:1;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-relation-view-region .relation-view-region-container.other-package{border-style:dashed}.bi-sequence-table-dynamic-number .sequence-table-title-cell{overflow:hidden;overflow-x:hidden;overflow-y:hidden;box-sizing:border-box}.bi-sequence-table-dynamic-number .sequence-table-number-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-list-number .sequence-table-title-cell{overflow:hidden;overflow-x:hidden;overflow-y:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-list-number .sequence-table-number-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-tree-number .sequence-table-title-cell{overflow:hidden;overflow-x:hidden;overflow-y:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-tree-number .sequence-table-number-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-param-time-interval.time-error .bi-input,.bi-param-time-interval.time-error .sign-editor-text{color:#e85050}.bi-year-popup .year-popup-navigation>.center-element{border-left:1px solid #d4dadd}.bi-year-popup .year-popup-navigation>.first-element{border-left:none}.bi-theme-dark .bi-year-popup .year-popup-navigation>.center-element{border-left:1px solid #525466}.bi-theme-dark .bi-year-popup .year-popup-navigation>.first-element{border-left:none}.bi-year-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}*,button,html,input,select,textarea{font-family:"Microsoft YaHei","Hiragino Sans GB W3"}html{overflow:hidden}body{position:absolute;width:100%;margin:0;padding:0;top:0;left:0;background-repeat:repeat;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;color:#666;font:400 12px "Microsoft YaHei","Hiragino Sans GB W3";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none;-kthml-user-focus:normal;-moz-user-focus:normal;-moz-outline:0 none;outline:0}div::-webkit-scrollbar,textarea::-webkit-scrollbar{-webkit-appearance:none;background-color:rgba(102,102,102,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666, endColorstr=#0d666666);width:6px;height:6px}div::-webkit-scrollbar-thumb,textarea::-webkit-scrollbar-thumb{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background-color:rgba(102,102,102,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666, endColorstr=#4d666666)}div::-webkit-scrollbar-thumb:hover,textarea::-webkit-scrollbar-thumb:hover{background-color:rgba(102,102,102,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666, endColorstr=#b3666666)}.bi-theme-dark div::-webkit-scrollbar,.bi-theme-dark textarea::-webkit-scrollbar{-webkit-appearance:none;background-color:rgba(204,204,204,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc, endColorstr=#0dcccccc);width:6px;height:6px}.bi-theme-dark div::-webkit-scrollbar-thumb,.bi-theme-dark textarea::-webkit-scrollbar-thumb{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background-color:rgba(204,204,204,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc, endColorstr=#4dcccccc)}.bi-theme-dark div::-webkit-scrollbar-thumb:hover,.bi-theme-dark textarea::-webkit-scrollbar-thumb:hover{background-color:rgba(204,204,204,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc, endColorstr=#b3cccccc)}.base-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-1.png) repeat-y}.bi-theme-dark .base-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-1.png) repeat-y}.first-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-2.png) center center no-repeat}.bi-theme-dark .first-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-2.png) center center no-repeat}.mid-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-3.png) center center no-repeat}.bi-theme-dark .mid-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-3.png) center center no-repeat}.last-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-4.png) center center no-repeat}.bi-theme-dark .last-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-4.png) center center no-repeat}.loading-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/loading.gif) center center no-repeat}.auto-color-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/background/auto-color.png) center center no-repeat}.trans-color-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/background/trans-color.png) center center no-repeat}@font-face{font-family:bi;src:url(https://fanruan.coding.me/fineui/dist/font/iconfont.eot),url(https://fanruan.coding.me/fineui/dist/font/iconfont.woff) format('woff'),url(https://fanruan.coding.me/fineui/dist/font/iconfont.ttf) format('truetype'),url(https://fanruan.coding.me/fineui/dist/font/iconfont.svg#svgFontName) format('svg')}@font-face{font-family:bi;src:url(https://fanruan.coding.me/fineui/dist/font/iconfont.eot)}.b-font{font-family:bi;font-style:normal;-webkit-font-smoothing:antialiased}.close-font .b-font:before,.close-font.disabled .b-font:before,.close-font.native .b-font:before,.close-h-font .b-font:before,.close-h-font.disabled .b-font:before,.close-h-font.hover .b-font:before,.close-h-font.native .b-font:before,.close-h-font:focus .b-font:before,.close-h-font:hover .b-font:before,.close-ha-font .b-font:before,.close-ha-font.hover .b-font:before,.close-ha-font:focus .b-font:before,.close-ha-font:hover .b-font:before{content:"\e600";color:inherit}.close-ha-font.active .b-font:before,.close-ha-font:active .b-font:before{content:"\e600";color:#3f8ce8}.close-ha-font.disabled .b-font:before,.close-ha-font.native .b-font:before,.search-close-h-font .b-font:before{content:"\e600";color:inherit}.search-close-h-font.hover .b-font:before,.search-close-h-font:focus .b-font:before,.search-close-h-font:hover .b-font:before{content:"\e600";color:#e85050}.search-close-h-font.disabled .b-font:before,.search-close-h-font.native .b-font:before{content:"\e600";color:inherit}.pre-page-h-font .b-font:before,.pre-page-h-font.disabled .b-font:before,.pre-page-h-font.hover .b-font:before,.pre-page-h-font.native .b-font:before,.pre-page-h-font:focus .b-font:before,.pre-page-h-font:hover .b-font:before{content:"\e601";color:inherit}.next-page-h-font .b-font:before,.next-page-h-font.disabled .b-font:before,.next-page-h-font.hover .b-font:before,.next-page-h-font.native .b-font:before,.next-page-h-font:focus .b-font:before,.next-page-h-font:hover .b-font:before{content:"\e602";color:inherit}.search-font .b-font:before,.search-font.disabled .b-font:before,.search-font.native .b-font:before{content:"\e604";color:inherit}.dot-font .b-font:before,.dot-font.disabled .b-font:before,.dot-font.native .b-font:before,.dot-h-font .b-font:before{content:"\e606";color:#1a1a1a}.dot-h-font.hover .b-font:before,.dot-h-font:focus .b-font:before,.dot-h-font:hover .b-font:before{content:"\e606";color:inherit}.dot-h-font.disabled .b-font:before,.dot-h-font.native .b-font:before{content:"\e606";color:#1a1a1a}.dot-ha-font .b-font:before{content:"\e606";color:#fff}.dot-ha-font.hover .b-font:before,.dot-ha-font:focus .b-font:before,.dot-ha-font:hover .b-font:before{content:"\e606";color:#999}.dot-ha-font.active .b-font:before,.dot-ha-font:active .b-font:before{content:"\e606";color:#1a1a1a}.dot-e-font .b-font:before,.dot-ha-font.disabled .b-font:before,.dot-ha-font.native .b-font:before{content:"\e606";color:#fff}.dot-e-font.hover .b-font:before,.dot-e-font:focus .b-font:before,.dot-e-font:hover .b-font:before{content:"\e606";color:#999}.dot-e-font.active .b-font:before{content:"\e606";color:#1a1a1a}.dot-e-font:active .b-font:before{content:"\e606";color:#3f8ce8}.dot-e-font.disabled .b-font:before,.dot-e-font.native .b-font:before{content:"\e606";color:#fff}.pull-right-font .b-font:before,.pull-right-font.disabled .b-font:before,.pull-right-font.native .b-font:before,.pull-right-h-font .b-font:before,.pull-right-h-font.disabled .b-font:before,.pull-right-h-font.hover .b-font:before,.pull-right-h-font.native .b-font:before,.pull-right-h-font:focus .b-font:before,.pull-right-h-font:hover .b-font:before,.pull-right-ha-font .b-font:before,.pull-right-ha-font.hover .b-font:before,.pull-right-ha-font:focus .b-font:before,.pull-right-ha-font:hover .b-font:before{content:"\e607";color:inherit}.pull-right-ha-font.active .b-font:before,.pull-right-ha-font:active .b-font:before{content:"\e607";color:#3f8ce8}.pull-right-e-font .b-font:before,.pull-right-e-font.hover .b-font:before,.pull-right-e-font:focus .b-font:before,.pull-right-e-font:hover .b-font:before,.pull-right-ha-font.disabled .b-font:before,.pull-right-ha-font.native .b-font:before{content:"\e607";color:inherit}.pull-right-e-font.active .b-font:before,.pull-right-e-font:active .b-font:before{content:"\e607";color:#3f8ce8}.pull-right-e-font.disabled .b-font:before,.pull-right-e-font.native .b-font:before{content:"\e607";color:inherit}.copy-font .b-font:before,.copy-font.disabled .b-font:before,.copy-font.native .b-font:before{content:"\e610";color:inherit}.copy-h-font .b-font:before{content:"\e610";color:#1a1a1a}.copy-h-font.hover .b-font:before,.copy-h-font:focus .b-font:before,.copy-h-font:hover .b-font:before{content:"\e610";color:inherit}.copy-h-font.disabled .b-font:before,.copy-h-font.native .b-font:before{content:"\e610";color:#1a1a1a}.copy-ha-font .b-font:before,.copy-ha-font.hover .b-font:before,.copy-ha-font:focus .b-font:before,.copy-ha-font:hover .b-font:before{content:"\e610";color:inherit}.copy-ha-font.active .b-font:before,.copy-ha-font:active .b-font:before{content:"\e610";color:#3f8ce8}.copy-e-font .b-font:before,.copy-e-font.hover .b-font:before,.copy-e-font:focus .b-font:before,.copy-e-font:hover .b-font:before,.copy-ha-font.disabled .b-font:before,.copy-ha-font.native .b-font:before{content:"\e610";color:inherit}.copy-e-font.active .b-font:before,.copy-e-font:active .b-font:before{content:"\e610";color:#3f8ce8}.copy-e-font.disabled .b-font:before,.copy-e-font.native .b-font:before{content:"\e610";color:inherit}.check-mark-font .b-font:before,.check-mark-font.disabled .b-font:before,.check-mark-font.native .b-font:before,.check-mark-h-font .b-font:before,.check-mark-h-font.disabled .b-font:before,.check-mark-h-font.hover .b-font:before,.check-mark-h-font.native .b-font:before,.check-mark-h-font:focus .b-font:before,.check-mark-h-font:hover .b-font:before,.check-mark-ha-font .b-font:before,.check-mark-ha-font.hover .b-font:before,.check-mark-ha-font:focus .b-font:before,.check-mark-ha-font:hover .b-font:before{content:"\e611";color:inherit}.check-mark-ha-font.active .b-font:before,.check-mark-ha-font:active .b-font:before{content:"\e611";color:#3f8ce8}.check-mark-e-font .b-font:before,.check-mark-e-font.hover .b-font:before,.check-mark-e-font:focus .b-font:before,.check-mark-e-font:hover .b-font:before,.check-mark-ha-font.disabled .b-font:before,.check-mark-ha-font.native .b-font:before{content:"\e611";color:inherit}.check-mark-e-font.active .b-font:before,.check-mark-e-font:active .b-font:before{content:"\e611";color:#3f8ce8}.check-mark-e-font.disabled .b-font:before,.check-mark-e-font.native .b-font:before{content:"\e611";color:inherit}.tree-node-triangle-expand-font .b-font:before,.tree-node-triangle-expand-font.disabled .b-font:before,.tree-node-triangle-expand-font.native .b-font:before{content:"\e608";color:inherit}.tree-node-triangle-collapse-font .b-font:before,.tree-node-triangle-collapse-font.disabled .b-font:before,.tree-node-triangle-collapse-font.native .b-font:before{content:"\e607";color:inherit}.row-pre-page-h-font .b-font:before,.row-pre-page-h-font.disabled .b-font:before,.row-pre-page-h-font.hover .b-font:before,.row-pre-page-h-font.native .b-font:before,.row-pre-page-h-font:focus .b-font:before,.row-pre-page-h-font:hover .b-font:before{content:"\e6be";color:inherit}.row-next-page-h-font .b-font:before,.row-next-page-h-font.disabled .b-font:before,.row-next-page-h-font.hover .b-font:before,.row-next-page-h-font.native .b-font:before,.row-next-page-h-font:focus .b-font:before,.row-next-page-h-font:hover .b-font:before{content:"\e6bd";color:inherit}.column-pre-page-h-font .b-font:before,.column-pre-page-h-font.disabled .b-font:before,.column-pre-page-h-font.hover .b-font:before,.column-pre-page-h-font.native .b-font:before,.column-pre-page-h-font:focus .b-font:before,.column-pre-page-h-font:hover .b-font:before{content:"\e6bc";color:inherit}.column-next-page-h-font .b-font:before,.column-next-page-h-font.disabled .b-font:before,.column-next-page-h-font.hover .b-font:before,.column-next-page-h-font.native .b-font:before,.column-next-page-h-font:focus .b-font:before,.column-next-page-h-font:hover .b-font:before{content:"\e6bb";color:inherit}.trigger-triangle-font .b-font:before,.trigger-triangle-font.hover .b-font:before,.trigger-triangle-font:focus .b-font:before,.trigger-triangle-font:hover .b-font:before{content:"\e66a";color:#999}.trigger-triangle-font.active .b-font:before,.trigger-triangle-font:active .b-font:before{content:"\e66a";color:#3f8ce8}.trigger-triangle-font.disabled .b-font:before,.trigger-triangle-font.native .b-font:before{content:"\e66a";color:#999}.pull-down-font .b-font:before,.pull-down-font.disabled .b-font:before,.pull-down-font.native .b-font:before,.pull-down-h-font .b-font:before,.pull-down-h-font.disabled .b-font:before,.pull-down-h-font.hover .b-font:before,.pull-down-h-font.native .b-font:before,.pull-down-h-font:focus .b-font:before,.pull-down-h-font:hover .b-font:before,.pull-down-ha-font .b-font:before,.pull-down-ha-font.hover .b-font:before,.pull-down-ha-font:focus .b-font:before,.pull-down-ha-font:hover .b-font:before{content:"\e608";color:inherit}.pull-down-ha-font.active .b-font:before,.pull-down-ha-font:active .b-font:before{content:"\e608";color:#3f8ce8}.pull-down-ha-font.disabled .b-font:before,.pull-down-ha-font.native .b-font:before{content:"\e608";color:inherit}.check-font .b-font:before,.check-font.disabled .b-font:before,.check-font.native .b-font:before{content:"\e611";color:#3f8ce8}.item-check-font .b-font:before{content:"\e611";color:#fff}.item-check-font.hover .b-font:before,.item-check-font:focus .b-font:before,.item-check-font:hover .b-font:before{content:"\e611";color:#999}.item-check-font.active .b-font:before,.item-check-font:active .b-font:before{content:"\e611";color:#3f8ce8}.item-check-font.disabled .b-font:before,.item-check-font.native .b-font:before{content:"\e611";color:#fff}.primary-key-font .b-font:before,.primary-key-font.disabled .b-font:before,.primary-key-font.hover .b-font:before,.primary-key-font.native .b-font:before,.primary-key-font:focus .b-font:before,.primary-key-font:hover .b-font:before{content:"\e67d;";color:inherit}.drag-tag-font .b-font:before,.drag-tag-font.disabled .b-font:before,.drag-tag-font.native .b-font:before{content:"\e600";color:#f07d0a}.less-font .b-font:before,.less-font.hover .b-font:before,.less-font:focus .b-font:before,.less-font:hover .b-font:before{content:"\e633";color:inherit}.less-font.active .b-font:before,.less-font:active .b-font:before{content:"\e633";color:#3f8ce8}.less-font.disabled .b-font:before,.less-font.native .b-font:before{content:"\e633";color:inherit}.less-equal-font .b-font:before,.less-equal-font.hover .b-font:before,.less-equal-font:focus .b-font:before,.less-equal-font:hover .b-font:before{content:"\e636";color:inherit}.less-equal-font.active .b-font:before,.less-equal-font:active .b-font:before{content:"\e636";color:#3f8ce8}.less-equal-font.disabled .b-font:before,.less-equal-font.native .b-font:before{content:"\e636";color:inherit}.text-bold-font .b-font:before,.text-bold-font.disabled .b-font:before,.text-bold-font.native .b-font:before{content:"\e64d";color:inherit}.text-italic-font .b-font:before,.text-italic-font.disabled .b-font:before,.text-italic-font.native .b-font:before{content:"\e656";color:inherit}.text-underline-font .b-font:before,.text-underline-font.disabled .b-font:before,.text-underline-font.native .b-font:before{content:"\e650";color:inherit}.text-color-font .b-font:before,.text-color-font.disabled .b-font:before,.text-color-font.native .b-font:before{content:"\e69c";color:inherit}.text-background-font .b-font:before,.text-background-font.disabled .b-font:before,.text-background-font.native .b-font:before{content:"\e696";color:inherit}.text-color-underline-font .b-font:before,.text-color-underline-font.disabled .b-font:before,.text-color-underline-font.native .b-font:before{content:"\e69d";color:inherit}.text-align-left-font .b-font:before,.text-align-left-font.disabled .b-font:before,.text-align-left-font.native .b-font:before{content:"\e654";color:inherit}.text-align-center-font .b-font:before,.text-align-center-font.disabled .b-font:before,.text-align-center-font.native .b-font:before{content:"\e64f";color:inherit}.text-align-right-font .b-font:before,.text-align-right-font.disabled .b-font:before,.text-align-right-font.native .b-font:before{content:"\e651";color:inherit}.tree-collapse-icon-type1 .x-icon,.tree-collapse-icon-type1:active .x-icon,.tree-collapse-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-1.png) no-repeat;background-size:contain}.tree-collapse-icon-type1 .x-icon.hack,.tree-collapse-icon-type1:active .x-icon.hack,.tree-collapse-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-1.png) no-repeat}.tree-collapse-icon-type1.disabled .x-icon,.tree-collapse-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-1.png) no-repeat;background-size:contain}.tree-collapse-icon-type1.disabled .x-icon.hack,.tree-collapse-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-1.png) no-repeat}.tree-collapse-icon-type2 .x-icon,.tree-collapse-icon-type2:active .x-icon,.tree-collapse-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-2.png) no-repeat;background-size:contain}.tree-collapse-icon-type2 .x-icon.hack,.tree-collapse-icon-type2:active .x-icon.hack,.tree-collapse-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-2.png) no-repeat}.tree-collapse-icon-type2.disabled .x-icon,.tree-collapse-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-2.png) no-repeat;background-size:contain}.tree-collapse-icon-type2.disabled .x-icon.hack,.tree-collapse-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-2.png) no-repeat}.tree-collapse-icon-type3 .x-icon,.tree-collapse-icon-type3:active .x-icon,.tree-collapse-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-3.png) no-repeat;background-size:contain}.tree-collapse-icon-type3 .x-icon.hack,.tree-collapse-icon-type3:active .x-icon.hack,.tree-collapse-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-3.png) no-repeat}.tree-collapse-icon-type3.disabled .x-icon,.tree-collapse-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-3.png) no-repeat;background-size:contain}.tree-collapse-icon-type3.disabled .x-icon.hack,.tree-collapse-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-3.png) no-repeat}.tree-collapse-icon-type4 .x-icon,.tree-collapse-icon-type4:active .x-icon,.tree-collapse-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-4.png) no-repeat;background-size:contain}.tree-collapse-icon-type4 .x-icon.hack,.tree-collapse-icon-type4:active .x-icon.hack,.tree-collapse-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-4.png) no-repeat}.tree-collapse-icon-type4.disabled .x-icon,.tree-collapse-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-4.png) no-repeat;background-size:contain}.tree-collapse-icon-type4.disabled .x-icon.hack,.tree-collapse-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-4.png) no-repeat}.tree-expand-icon-type1 .x-icon,.tree-expand-icon-type1:active .x-icon,.tree-expand-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-1.png) no-repeat;background-size:contain}.tree-expand-icon-type1 .x-icon.hack,.tree-expand-icon-type1:active .x-icon.hack,.tree-expand-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-1.png) no-repeat}.tree-expand-icon-type1.disabled .x-icon,.tree-expand-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-1.png) no-repeat;background-size:contain}.tree-expand-icon-type1.disabled .x-icon.hack,.tree-expand-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-1.png) no-repeat}.tree-expand-icon-type2 .x-icon,.tree-expand-icon-type2:active .x-icon,.tree-expand-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-2.png) no-repeat;background-size:contain}.tree-expand-icon-type2 .x-icon.hack,.tree-expand-icon-type2:active .x-icon.hack,.tree-expand-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-2.png) no-repeat}.tree-expand-icon-type2.disabled .x-icon,.tree-expand-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-2.png) no-repeat;background-size:contain}.tree-expand-icon-type2.disabled .x-icon.hack,.tree-expand-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-2.png) no-repeat}.tree-expand-icon-type3 .x-icon,.tree-expand-icon-type3:active .x-icon,.tree-expand-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-3.png) no-repeat;background-size:contain}.tree-expand-icon-type3 .x-icon.hack,.tree-expand-icon-type3:active .x-icon.hack,.tree-expand-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-3.png) no-repeat}.tree-expand-icon-type3.disabled .x-icon,.tree-expand-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-3.png) no-repeat;background-size:contain}.tree-expand-icon-type3.disabled .x-icon.hack,.tree-expand-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-3.png) no-repeat}.tree-expand-icon-type4 .x-icon,.tree-expand-icon-type4:active .x-icon,.tree-expand-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-4.png) no-repeat;background-size:contain}.tree-expand-icon-type4 .x-icon.hack,.tree-expand-icon-type4:active .x-icon.hack,.tree-expand-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-4.png) no-repeat}.tree-expand-icon-type4.disabled .x-icon,.tree-expand-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-4.png) no-repeat;background-size:contain}.tree-expand-icon-type4.disabled .x-icon.hack,.tree-expand-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-4.png) no-repeat}.tree-vertical-line-type2 .x-icon,.tree-vertical-line-type2:active .x-icon,.tree-vertical-line-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-2.png) no-repeat;background-size:contain}.tree-vertical-line-type2 .x-icon.hack,.tree-vertical-line-type2:active .x-icon.hack,.tree-vertical-line-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-2.png) no-repeat}.tree-vertical-line-type2.disabled .x-icon,.tree-vertical-line-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-2.png) no-repeat;background-size:contain}.tree-vertical-line-type2.disabled .x-icon.hack,.tree-vertical-line-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-2.png) no-repeat}.tree-vertical-line-type3 .x-icon,.tree-vertical-line-type3:active .x-icon,.tree-vertical-line-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-3.png) no-repeat;background-size:contain}.tree-vertical-line-type3 .x-icon.hack,.tree-vertical-line-type3:active .x-icon.hack,.tree-vertical-line-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-3.png) no-repeat}.tree-vertical-line-type3.disabled .x-icon,.tree-vertical-line-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-3.png) no-repeat;background-size:contain}.tree-vertical-line-type3.disabled .x-icon.hack,.tree-vertical-line-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-3.png) no-repeat}.tree-vertical-line-type4 .x-icon,.tree-vertical-line-type4:active .x-icon,.tree-vertical-line-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-4.png) no-repeat;background-size:contain}.tree-vertical-line-type4 .x-icon.hack,.tree-vertical-line-type4:active .x-icon.hack,.tree-vertical-line-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-4.png) no-repeat}.tree-vertical-line-type4.disabled .x-icon,.tree-vertical-line-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-4.png) no-repeat;background-size:contain}.tree-vertical-line-type4.disabled .x-icon.hack,.tree-vertical-line-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-4.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type1 .x-icon,.bi-theme-dark .tree-collapse-icon-type1:active .x-icon,.bi-theme-dark .tree-collapse-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type1 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type1:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-1.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type1.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type1.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-1.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type2 .x-icon,.bi-theme-dark .tree-collapse-icon-type2:active .x-icon,.bi-theme-dark .tree-collapse-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type2 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type2:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-2.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type2.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type2.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-2.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type3 .x-icon,.bi-theme-dark .tree-collapse-icon-type3:active .x-icon,.bi-theme-dark .tree-collapse-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type3 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type3:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-3.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type3.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type3.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-3.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type4 .x-icon,.bi-theme-dark .tree-collapse-icon-type4:active .x-icon,.bi-theme-dark .tree-collapse-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type4 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type4:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-4.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type4.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type4.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-4.png) no-repeat}.bi-theme-dark .tree-expand-icon-type1 .x-icon,.bi-theme-dark .tree-expand-icon-type1:active .x-icon,.bi-theme-dark .tree-expand-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type1 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type1:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-1.png) no-repeat}.bi-theme-dark .tree-expand-icon-type1.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type1.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-1.png) no-repeat}.bi-theme-dark .tree-expand-icon-type2 .x-icon,.bi-theme-dark .tree-expand-icon-type2:active .x-icon,.bi-theme-dark .tree-expand-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type2 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type2:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-2.png) no-repeat}.bi-theme-dark .tree-expand-icon-type2.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type2.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-2.png) no-repeat}.bi-theme-dark .tree-expand-icon-type3 .x-icon,.bi-theme-dark .tree-expand-icon-type3:active .x-icon,.bi-theme-dark .tree-expand-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type3 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type3:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-3.png) no-repeat}.bi-theme-dark .tree-expand-icon-type3.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type3.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-3.png) no-repeat}.bi-theme-dark .tree-expand-icon-type4 .x-icon,.bi-theme-dark .tree-expand-icon-type4:active .x-icon,.bi-theme-dark .tree-expand-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type4 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type4:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-4.png) no-repeat}.bi-theme-dark .tree-expand-icon-type4.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type4.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-4.png) no-repeat}.bi-theme-dark .tree-vertical-line-type2 .x-icon,.bi-theme-dark .tree-vertical-line-type2:active .x-icon,.bi-theme-dark .tree-vertical-line-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type2 .x-icon.hack,.bi-theme-dark .tree-vertical-line-type2:active .x-icon.hack,.bi-theme-dark .tree-vertical-line-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-2.png) no-repeat}.bi-theme-dark .tree-vertical-line-type2.disabled .x-icon,.bi-theme-dark .tree-vertical-line-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type2.disabled .x-icon.hack,.bi-theme-dark .tree-vertical-line-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-2.png) no-repeat}.bi-theme-dark .tree-vertical-line-type3 .x-icon,.bi-theme-dark .tree-vertical-line-type3:active .x-icon,.bi-theme-dark .tree-vertical-line-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type3 .x-icon.hack,.bi-theme-dark .tree-vertical-line-type3:active .x-icon.hack,.bi-theme-dark .tree-vertical-line-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-3.png) no-repeat}.bi-theme-dark .tree-vertical-line-type3.disabled .x-icon,.bi-theme-dark .tree-vertical-line-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type3.disabled .x-icon.hack,.bi-theme-dark .tree-vertical-line-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-3.png) no-repeat}.bi-theme-dark .tree-vertical-line-type4 .x-icon,.bi-theme-dark .tree-vertical-line-type4:active .x-icon,.bi-theme-dark .tree-vertical-line-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type4 .x-icon.hack,.bi-theme-dark .tree-vertical-line-type4:active .x-icon.hack,.bi-theme-dark .tree-vertical-line-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-4.png) no-repeat}.bi-theme-dark .tree-vertical-line-type4.disabled .x-icon,.bi-theme-dark .tree-vertical-line-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type4.disabled .x-icon.hack,.bi-theme-dark .tree-vertical-line-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-4.png) no-repeat}.check-box-icon .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-normal.png) no-repeat;background-size:contain}.check-box-icon .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-normal.png) no-repeat}.check-box-icon.hover .x-icon,.check-box-icon:focus .x-icon,.check-box-icon:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-normal.png) no-repeat;background-size:contain}.check-box-icon.hover .x-icon.hack,.check-box-icon:focus .x-icon.hack,.check-box-icon:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-normal.png) no-repeat}.check-box-icon.active .x-icon,.check-box-icon:active .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-active.png) no-repeat;background-size:contain}.check-box-icon.active .x-icon.hack,.check-box-icon:active .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-active.png) no-repeat}.check-box-icon.disabled .x-icon,.check-box-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-disable.png) no-repeat;background-size:contain}.check-box-icon.disabled .x-icon.hack,.check-box-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-disable.png) no-repeat}.check-box-icon.disabled.active .x-icon,.check-box-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-disable2.png) no-repeat;background-size:contain}.check-box-icon.disabled.active .x-icon.hack,.check-box-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-disable2.png) no-repeat}.radio-icon .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-normal.png) no-repeat;background-size:contain}.radio-icon .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-normal.png) no-repeat}.radio-icon.hover .x-icon,.radio-icon:focus .x-icon,.radio-icon:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-normal.png) no-repeat;background-size:contain}.radio-icon.hover .x-icon.hack,.radio-icon:focus .x-icon.hack,.radio-icon:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-normal.png) no-repeat}.radio-icon.active .x-icon,.radio-icon:active .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-active.png) no-repeat;background-size:contain}.radio-icon.active .x-icon.hack,.radio-icon:active .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-active.png) no-repeat}.radio-icon.disabled .x-icon,.radio-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-disable.png) no-repeat;background-size:contain}.radio-icon.disabled .x-icon.hack,.radio-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-disable.png) no-repeat}.radio-icon.disabled.active .x-icon,.radio-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-disable2.png) no-repeat;background-size:contain}.radio-icon.disabled.active .x-icon.hack,.radio-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-disable2.png) no-repeat}.check-half-select-icon .x-icon,.check-half-select-icon:active .x-icon,.check-half-select-icon:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/half_selected.png) no-repeat;background-size:contain}.check-half-select-icon .x-icon.hack,.check-half-select-icon:active .x-icon.hack,.check-half-select-icon:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/half_selected.png) no-repeat}.check-half-select-icon.disabled .x-icon,.check-half-select-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/half_selected.png) no-repeat;background-size:contain}.check-half-select-icon.disabled .x-icon.hack,.check-half-select-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/half_selected.png) no-repeat} \ No newline at end of file +/*! normalize.css v1.0.0 | MIT License | git.io/normalize */dl,h3,menu,ol,p,pre,ul{margin:1em 0}.b-font,i{-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.bi-label,.bi-text,.overflow-dot{text-overflow:ellipsis}.cm-em,dfn{font-style:italic}.bi-excel-table-header-cell,.bi-preview-table-header-cell,.cm-header,.cm-strong,b,strong{font-weight:700}.b-font,body,i{-moz-osx-font-smoothing:grayscale}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.75em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}blockquote{margin:1em 40px}mark{background:#ff0;color:#000}.base-disabled,.base-disabled .b-font:before,.base-disabled .bi-input,.base-disabled .bi-textarea{color:#ccc!important}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}small,sub,sup{font-size:75%}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:after,q:before{content:'';content:none}sub,sup{line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ol,nav ul{list-style:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure,form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline}button,input{line-height:normal}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],input[disabled]{cursor:default}.base-disabled,.base-invalid{cursor:default!important}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.bi-collection-table-cell,.bi-text,.border-sizing{-moz-box-sizing:border-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}*,a,body,div,html,img,li,ol,p,span,ul{margin:0;padding:0}a{outline:0;text-decoration:none}a:focus{outline:0}input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}input::-ms-clear{display:none}input,textarea{margin:0;padding:0;outline:0;border:1px solid #d4dadd}.bi-theme-dark input,.bi-theme-dark textarea{border:1px solid #525466}ul{list-style:disc}li{list-style-type:none}i{-webkit-font-smoothing:antialiased}.bi-theme-dark .base-disabled,.bi-theme-dark .base-disabled .b-font:before,.bi-theme-dark .base-disabled .bi-input,.bi-theme-dark .base-disabled .bi-textarea{color:#666!important}.clearfix:after,.clearfix:before{content:" ";display:table;line-height:0}.clearfix:after{clear:both}.bi-background{background-color:#eff1f4;color:#666}.bi-background .bi-input,.bi-background .bi-textarea{color:#666}.bi-theme-dark .bi-background{background-color:#191b2b;color:#ccc}.bi-theme-dark .bi-background .bi-input,.bi-theme-dark .bi-background .bi-textarea{color:#ccc}.bi-card,.bi-card .bi-input,.bi-card .bi-textarea{color:#666}.bi-card{background-color:#fff}.bi-theme-dark .bi-card{background-color:#242640;color:#ccc}.bi-disabled,.bi-disabled .bi-input,.bi-disabled .bi-textarea,.bi-theme-dark .bi-card .bi-input,.bi-theme-dark .bi-card .bi-textarea{color:#ccc}.bi-theme-dark .bi-disabled,.bi-theme-dark .bi-disabled .bi-input,.bi-theme-dark .bi-disabled .bi-textarea{color:#666}.bi-tips,.bi-tips .bi-input,.bi-tips .bi-textarea{color:#999}.bi-border{border:1px solid #d4dadd}.bi-theme-dark .bi-border{border:1px solid #525466}.bi-border-left{border-left:1px solid #d4dadd}.bi-theme-dark .bi-border-left{border-left:1px solid #525466}.bi-border-right{border-right:1px solid #d4dadd}.bi-theme-dark .bi-border-right{border-right:1px solid #525466}.bi-border-top{border-top:1px solid #d4dadd}.bi-theme-dark .bi-border-top{border-top:1px solid #525466}.bi-border-bottom{border-bottom:1px solid #d4dadd}.bi-theme-dark .bi-border-bottom{border-bottom:1px solid #525466}.bi-keyword-red-mark,.bi-keyword-red-mark .bi-input,.bi-keyword-red-mark .bi-textarea{color:#f07d0a}.bi-high-light,.bi-high-light .bi-input,.bi-high-light .bi-textarea{color:#3f8ce8}.bi-high-light-background{background-color:#3f8ce8;color:#fff}.bi-high-light-background .bi-input,.bi-high-light-background .bi-textarea{color:#fff}.bi-high-light-border{border-color:#178cdf}.bi-water-mark{color:#ccc;cursor:text}.bi-water-mark .bi-input,.bi-water-mark .bi-textarea{color:#ccc}.bi-theme-dark .bi-water-mark,.bi-theme-dark .bi-water-mark .bi-input,.bi-theme-dark .bi-water-mark .bi-textarea{color:#666}.bi-mask,.bi-mask .bi-input,.bi-mask .bi-textarea{color:#fff}.bi-resizer{background:#1a1a1a;opacity:.2;filter:alpha(opacity=20);z-index:1000000000!important}.bi-theme-dark .bi-resizer{background:#fff}.bi-mask{background-color:rgba(26,26,26,.2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#331a1a1a, endColorstr=#331a1a1a)}.bi-theme-dark .bi-mask{color:#242640;background-color:rgba(255,255,255,.2);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff, endColorstr=#33ffffff)}.bi-theme-dark .bi-mask .bi-input,.bi-theme-dark .bi-mask .bi-textarea{color:#242640}.bi-z-index-mask{color:#fff;background-color:rgba(26,26,26,.5);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a, endColorstr=#801a1a1a)}.bi-z-index-mask .bi-input,.bi-z-index-mask .bi-textarea{color:#fff}.bi-list-item.hover,.bi-list-item:hover{color:#1a1a1a;background-color:rgba(26,26,26,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a, endColorstr=#0d1a1a1a)}.bi-list-item.hover .bi-input,.bi-list-item.hover .bi-textarea,.bi-list-item:hover .bi-input,.bi-list-item:hover .bi-textarea{color:#1a1a1a}.bi-list-item.disabled,.bi-list-item.disabled:active,.bi-list-item.disabled:hover{background-color:transparent!important;color:#ccc!important}.bi-list-item.disabled .bi-high-light,.bi-list-item.disabled .bi-input,.bi-list-item.disabled .bi-textarea,.bi-list-item.disabled:active .bi-high-light,.bi-list-item.disabled:active .bi-input,.bi-list-item.disabled:active .bi-textarea,.bi-list-item.disabled:hover .bi-high-light,.bi-list-item.disabled:hover .bi-input,.bi-list-item.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item.hover,.bi-theme-dark .bi-list-item:hover{color:#fff;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item.hover .bi-input,.bi-theme-dark .bi-list-item.hover .bi-textarea,.bi-theme-dark .bi-list-item:hover .bi-input,.bi-theme-dark .bi-list-item:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item.disabled,.bi-theme-dark .bi-list-item.disabled:active,.bi-theme-dark .bi-list-item.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item.disabled .bi-high-light,.bi-theme-dark .bi-list-item.disabled .bi-input,.bi-theme-dark .bi-list-item.disabled .bi-textarea,.bi-theme-dark .bi-list-item.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item.disabled:active .bi-input,.bi-theme-dark .bi-list-item.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item.disabled:hover .bi-input,.bi-theme-dark .bi-list-item.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-border.active,.bi-list-item-border:active{border:1px solid #178cdf}.bi-list-item-simple,.bi-list-item-simple .bi-input,.bi-list-item-simple .bi-textarea{color:#999}.bi-list-item-simple.hover,.bi-list-item-simple.hover .bi-input,.bi-list-item-simple.hover .bi-textarea,.bi-list-item-simple:hover,.bi-list-item-simple:hover .bi-input,.bi-list-item-simple:hover .bi-textarea{color:#3f8ce8}.bi-list-item-simple.disabled,.bi-list-item-simple.disabled .bi-high-light,.bi-list-item-simple.disabled .bi-input,.bi-list-item-simple.disabled .bi-textarea,.bi-list-item-simple.disabled:active,.bi-list-item-simple.disabled:active .bi-high-light,.bi-list-item-simple.disabled:active .bi-input,.bi-list-item-simple.disabled:active .bi-textarea,.bi-list-item-simple.disabled:hover,.bi-list-item-simple.disabled:hover .bi-high-light,.bi-list-item-simple.disabled:hover .bi-input,.bi-list-item-simple.disabled:hover .bi-textarea{color:#ccc!important}.bi-list-item-effect:hover,.bi-list-item-effect:hover .bi-input,.bi-list-item-effect:hover .bi-textarea{color:#1a1a1a}.bi-list-item-effect.active,.bi-list-item-effect.active .bi-input,.bi-list-item-effect.active .bi-textarea,.bi-list-item-effect:active,.bi-list-item-effect:active .bi-input,.bi-list-item-effect:active .bi-textarea{color:#3f8ce8}.bi-list-item-effect.disabled,.bi-list-item-effect.disabled .bi-high-light,.bi-list-item-effect.disabled .bi-input,.bi-list-item-effect.disabled .bi-textarea,.bi-list-item-effect.disabled:active,.bi-list-item-effect.disabled:active .bi-high-light,.bi-list-item-effect.disabled:active .bi-input,.bi-list-item-effect.disabled:active .bi-textarea,.bi-list-item-effect.disabled:hover,.bi-list-item-effect.disabled:hover .bi-high-light,.bi-list-item-effect.disabled:hover .bi-input,.bi-list-item-effect.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-effect:hover,.bi-theme-dark .bi-list-item-effect:hover .bi-input,.bi-theme-dark .bi-list-item-effect:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-effect.active,.bi-theme-dark .bi-list-item-effect.active .bi-input,.bi-theme-dark .bi-list-item-effect.active .bi-textarea,.bi-theme-dark .bi-list-item-effect:active,.bi-theme-dark .bi-list-item-effect:active .bi-input,.bi-theme-dark .bi-list-item-effect:active .bi-textarea{color:#3f8ce8}.bi-theme-dark .bi-list-item-effect.disabled,.bi-theme-dark .bi-list-item-effect.disabled:active,.bi-theme-dark .bi-list-item-effect.disabled:hover{background-color:transparent!important;color:#666!important}.bi-list-item-active.active,.bi-list-item-active.hover,.bi-list-item-active:active,.bi-list-item-active:hover{background-color:rgba(26,26,26,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a, endColorstr=#0d1a1a1a)}.bi-theme-dark .bi-list-item-effect.disabled .bi-high-light,.bi-theme-dark .bi-list-item-effect.disabled .bi-input,.bi-theme-dark .bi-list-item-effect.disabled .bi-textarea,.bi-theme-dark .bi-list-item-effect.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-effect.disabled:active .bi-input,.bi-theme-dark .bi-list-item-effect.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-active.hover,.bi-list-item-active.hover .bi-input,.bi-list-item-active.hover .bi-textarea,.bi-list-item-active:hover,.bi-list-item-active:hover .bi-input,.bi-list-item-active:hover .bi-textarea{color:#1a1a1a}.bi-list-item-active.active,.bi-list-item-active.active .bi-input,.bi-list-item-active.active .bi-textarea,.bi-list-item-active:active,.bi-list-item-active:active .bi-input,.bi-list-item-active:active .bi-textarea{color:#3f8ce8}.bi-list-item-active.disabled,.bi-list-item-active.disabled:active,.bi-list-item-active.disabled:hover{background-color:transparent!important;color:#ccc!important}.bi-list-item-active.disabled .bi-high-light,.bi-list-item-active.disabled .bi-input,.bi-list-item-active.disabled .bi-textarea,.bi-list-item-active.disabled:active .bi-high-light,.bi-list-item-active.disabled:active .bi-input,.bi-list-item-active.disabled:active .bi-textarea,.bi-list-item-active.disabled:hover .bi-high-light,.bi-list-item-active.disabled:hover .bi-input,.bi-list-item-active.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-active.hover,.bi-theme-dark .bi-list-item-active:hover{color:#fff;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item-active.hover .bi-input,.bi-theme-dark .bi-list-item-active.hover .bi-textarea,.bi-theme-dark .bi-list-item-active:hover .bi-input,.bi-theme-dark .bi-list-item-active:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-active.active,.bi-theme-dark .bi-list-item-active:active{color:#3f8ce8;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item-active.active .bi-input,.bi-theme-dark .bi-list-item-active.active .bi-textarea,.bi-theme-dark .bi-list-item-active:active .bi-input,.bi-theme-dark .bi-list-item-active:active .bi-textarea{color:#3f8ce8}.bi-theme-dark .bi-list-item-active.disabled,.bi-theme-dark .bi-list-item-active.disabled:active,.bi-theme-dark .bi-list-item-active.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-active.disabled .bi-high-light,.bi-theme-dark .bi-list-item-active.disabled .bi-input,.bi-theme-dark .bi-list-item-active.disabled .bi-textarea,.bi-theme-dark .bi-list-item-active.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-active.disabled:active .bi-input,.bi-theme-dark .bi-list-item-active.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-active.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-active.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-active.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-active2.hover,.bi-list-item-active2:hover{color:#1a1a1a;background-color:#fff}.bi-list-item-active2.hover .bi-input,.bi-list-item-active2.hover .bi-textarea,.bi-list-item-active2:hover .bi-input,.bi-list-item-active2:hover .bi-textarea{color:#1a1a1a}.bi-list-item-active2.active,.bi-list-item-active2:active{color:#3f8ce8;background-color:#fff}.bi-list-item-active2.active .bi-input,.bi-list-item-active2.active .bi-textarea,.bi-list-item-active2:active .bi-input,.bi-list-item-active2:active .bi-textarea{color:#3f8ce8}.bi-list-item-active2.disabled,.bi-list-item-active2.disabled:active,.bi-list-item-active2.disabled:hover{background-color:transparent!important;color:#ccc!important}.bi-list-item-active2.disabled .bi-high-light,.bi-list-item-active2.disabled .bi-input,.bi-list-item-active2.disabled .bi-textarea,.bi-list-item-active2.disabled:active .bi-high-light,.bi-list-item-active2.disabled:active .bi-input,.bi-list-item-active2.disabled:active .bi-textarea,.bi-list-item-active2.disabled:hover .bi-high-light,.bi-list-item-active2.disabled:hover .bi-input,.bi-list-item-active2.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-active2.hover,.bi-theme-dark .bi-list-item-active2:hover{color:#fff;background-color:#242640}.bi-theme-dark .bi-list-item-active2.hover .bi-input,.bi-theme-dark .bi-list-item-active2.hover .bi-textarea,.bi-theme-dark .bi-list-item-active2:hover .bi-input,.bi-theme-dark .bi-list-item-active2:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-active2.active,.bi-theme-dark .bi-list-item-active2:active{color:#3f8ce8;background-color:#242640}.bi-theme-dark .bi-list-item-active2.active .bi-input,.bi-theme-dark .bi-list-item-active2.active .bi-textarea,.bi-theme-dark .bi-list-item-active2:active .bi-input,.bi-theme-dark .bi-list-item-active2:active .bi-textarea{color:#3f8ce8}.bi-theme-dark .bi-list-item-active2.disabled,.bi-theme-dark .bi-list-item-active2.disabled:active,.bi-theme-dark .bi-list-item-active2.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-active2.disabled .bi-high-light,.bi-theme-dark .bi-list-item-active2.disabled .bi-input,.bi-theme-dark .bi-list-item-active2.disabled .bi-textarea,.bi-theme-dark .bi-list-item-active2.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-active2.disabled:active .bi-input,.bi-theme-dark .bi-list-item-active2.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-select.hover,.bi-list-item-select:hover{color:#1a1a1a;background-color:rgba(26,26,26,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a, endColorstr=#0d1a1a1a)}.bi-list-item-select.hover .bi-input,.bi-list-item-select.hover .bi-textarea,.bi-list-item-select:hover .bi-input,.bi-list-item-select:hover .bi-textarea{color:#1a1a1a}.bi-list-item-select.active,.bi-list-item-select:active{color:#fff;background-color:#3f8ce8}.bi-list-item-select.active .bi-high-light,.bi-list-item-select.active .bi-input,.bi-list-item-select.active .bi-textarea,.bi-list-item-select:active .bi-high-light,.bi-list-item-select:active .bi-input,.bi-list-item-select:active .bi-textarea{color:#fff}.bi-list-item-select.disabled,.bi-list-item-select.disabled:active,.bi-list-item-select.disabled:hover{color:#ccc!important;background-color:transparent!important}.bi-list-item-select.disabled .bi-high-light,.bi-list-item-select.disabled .bi-input,.bi-list-item-select.disabled .bi-textarea,.bi-list-item-select.disabled:active .bi-high-light,.bi-list-item-select.disabled:active .bi-input,.bi-list-item-select.disabled:active .bi-textarea,.bi-list-item-select.disabled:hover .bi-high-light,.bi-list-item-select.disabled:hover .bi-input,.bi-list-item-select.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-select.hover,.bi-theme-dark .bi-list-item-select:hover{color:#fff;background-color:rgba(255,255,255,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff, endColorstr=#0dffffff)}.bi-theme-dark .bi-list-item-select.hover .bi-input,.bi-theme-dark .bi-list-item-select.hover .bi-textarea,.bi-theme-dark .bi-list-item-select:hover .bi-input,.bi-theme-dark .bi-list-item-select:hover .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-select.active,.bi-theme-dark .bi-list-item-select:active{color:#fff;background-color:#3f8ce8}.bi-theme-dark .bi-list-item-select.active .bi-high-light,.bi-theme-dark .bi-list-item-select.active .bi-input,.bi-theme-dark .bi-list-item-select.active .bi-textarea,.bi-theme-dark .bi-list-item-select:active .bi-high-light,.bi-theme-dark .bi-list-item-select:active .bi-input,.bi-theme-dark .bi-list-item-select:active .bi-textarea{color:#fff}.bi-theme-dark .bi-list-item-select.disabled,.bi-theme-dark .bi-list-item-select.disabled:active,.bi-theme-dark .bi-list-item-select.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-select.disabled .bi-high-light,.bi-theme-dark .bi-list-item-select.disabled .bi-input,.bi-theme-dark .bi-list-item-select.disabled .bi-textarea,.bi-theme-dark .bi-list-item-select.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-select.disabled:active .bi-input,.bi-theme-dark .bi-list-item-select.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-select.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-select.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-select.disabled:hover .bi-textarea{color:#666!important}.bi-list-item-none.hover,.bi-list-item-none:hover{color:inherit;background-color:transparent}.bi-list-item-none.hover .bi-input,.bi-list-item-none.hover .bi-textarea,.bi-list-item-none:hover .bi-input,.bi-list-item-none:hover .bi-textarea{color:inherit}.bi-list-item-none.active,.bi-list-item-none:active{color:inherit;background-color:transparent}.bi-list-item-none.active .bi-high-light,.bi-list-item-none.active .bi-input,.bi-list-item-none.active .bi-textarea,.bi-list-item-none:active .bi-high-light,.bi-list-item-none:active .bi-input,.bi-list-item-none:active .bi-textarea{color:inherit}.bi-list-item-none.disabled,.bi-list-item-none.disabled:active,.bi-list-item-none.disabled:hover{color:#ccc!important;background-color:transparent!important}.bi-list-item-none.disabled .bi-high-light,.bi-list-item-none.disabled .bi-input,.bi-list-item-none.disabled .bi-textarea,.bi-list-item-none.disabled:active .bi-high-light,.bi-list-item-none.disabled:active .bi-input,.bi-list-item-none.disabled:active .bi-textarea,.bi-list-item-none.disabled:hover .bi-high-light,.bi-list-item-none.disabled:hover .bi-input,.bi-list-item-none.disabled:hover .bi-textarea{color:#ccc!important}.bi-theme-dark .bi-list-item-none.hover,.bi-theme-dark .bi-list-item-none:hover{color:inherit;background-color:transparent}.bi-theme-dark .bi-list-item-none.hover .bi-input,.bi-theme-dark .bi-list-item-none.hover .bi-textarea,.bi-theme-dark .bi-list-item-none:hover .bi-input,.bi-theme-dark .bi-list-item-none:hover .bi-textarea{color:inherit}.bi-theme-dark .bi-list-item-none.active,.bi-theme-dark .bi-list-item-none:active{color:inherit;background-color:transparent}.bi-theme-dark .bi-list-item-none.active .bi-high-light,.bi-theme-dark .bi-list-item-none.active .bi-input,.bi-theme-dark .bi-list-item-none.active .bi-textarea,.bi-theme-dark .bi-list-item-none:active .bi-high-light,.bi-theme-dark .bi-list-item-none:active .bi-input,.bi-theme-dark .bi-list-item-none:active .bi-textarea{color:inherit}.bi-theme-dark .bi-list-item-none.disabled,.bi-theme-dark .bi-list-item-none.disabled:active,.bi-theme-dark .bi-list-item-none.disabled:hover{background-color:transparent!important;color:#666!important}.bi-theme-dark .bi-list-item-none.disabled .bi-high-light,.bi-theme-dark .bi-list-item-none.disabled .bi-input,.bi-theme-dark .bi-list-item-none.disabled .bi-textarea,.bi-theme-dark .bi-list-item-none.disabled:active .bi-high-light,.bi-theme-dark .bi-list-item-none.disabled:active .bi-input,.bi-theme-dark .bi-list-item-none.disabled:active .bi-textarea,.bi-theme-dark .bi-list-item-none.disabled:hover .bi-high-light,.bi-theme-dark .bi-list-item-none.disabled:hover .bi-input,.bi-theme-dark .bi-list-item-none.disabled:hover .bi-textarea{color:#666!important}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.cursor-move{cursor:move}.y-overflow-auto{overflow-y:auto;overflow-x:hidden}.x-overflow-auto{overflow-y:hidden;overflow-x:auto}.y-overflow-scroll{overflow-y:scroll;overflow-x:hidden}.x-overflow-scroll{overflow-y:hidden;overflow-x:scroll}.overflow-auto{overflow-x:auto;overflow-y:auto}.overflow-scroll{overflow-x:scroll;overflow-y:scroll}.overflow-dot,.overflow-hidden{overflow-x:hidden;overflow-y:hidden}.td-overflow{white-space:normal;word-break:break-all}.overflow-dot{white-space:nowrap}.display-block{display:block}.display-inline{display:inline-block}.vertical-super{vertical-align:super}.vertical-top{vertical-align:top}.horizon-center{text-align:center}.horizon-left{text-align:left}.border-sizing{-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.content-sizing{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;-ms-box-sizing:content-box;box-sizing:content-box}.bi-flex-center-layout{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center}.bi-flex-horizontal-layout{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:flex-start;-webkit-align-items:flex-start;-moz-align-items:flex-start;-ms-align-items:flex-start;-o-align-items:flex-start;align-items:flex-start;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap}.bi-flex-horizontal-layout.middle{-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center}.bi-flex-horizontal-layout.bottom{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-moz-align-items:flex-end;-ms-align-items:flex-end;-o-align-items:flex-end;align-items:flex-end}.bi-flex-vertical-center{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap}.bi-flex-vertical-center.stretch{-webkit-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;-o-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;-ms-align-items:stretch;-o-align-items:stretch;align-items:stretch}.bi-flex-wrapper-center-layout .flex-wrapper-center-layout-wrapper{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;min-width:100%;min-height:100%;float:left}.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:flex-start;-webkit-align-items:flex-start;-moz-align-items:flex-start;-ms-align-items:flex-start;-o-align-items:flex-start;align-items:flex-start;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap;min-height:100%}.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.middle{-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center}.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.bottom{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-moz-align-items:flex-end;-ms-align-items:flex-end;-o-align-items:flex-end;align-items:flex-end}.bi-flex-wrapper-vertical-center .flex-wrapper-vertical-center-wrapper{display:box;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;-o-flex-direction:row;flex-direction:row;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-moz-justify-content:flex-start;-ms-justify-content:flex-start;-o-justify-content:flex-start;justify-content:flex-start;-webkit-box-align:center;-webkit-align-items:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;-webkit-flex-wrap:nowrap;-moz-flex-wrap:nowrap;-ms-flex-wrap:nowrap;-o-flex-wrap:nowrap;flex-wrap:nowrap;min-height:100%;float:left}.bi-flex-wrapper-vertical-center .flex-wrapper-vertical-center-wrapper.stretch{width:100%;-webkit-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;-o-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-webkit-box-align:stretch;-webkit-align-items:stretch;-moz-align-items:stretch;-ms-align-items:stretch;-o-align-items:stretch;align-items:stretch}.bi-inline-center-adapt-layout:after,.bi-inline-vertical-adapt-layout:after{display:inline-block;width:0;min-height:100%;vertical-align:middle;content:' '}.cm-tab-wrap-hack:after,.scrollbar-layout-face:after{content:''}.bi-theme-dark{background-color:#191b2b;color:#ccc}.bi-theme-dark .bi-input{color:#fff}.bi-color-chooser-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;box-shadow:0 0 2px 1px #d4dadd inset;-webkit-box-shadow:0 0 2px 1px #d4dadd inset;-moz-box-shadow:0 0 2px 1px #d4dadd inset}.bi-color-picker-button .color-picker-button-mask{border:1px solid #1a1a1a}.bi-theme-dark .bi-color-picker-button .color-picker-button-mask{border:1px solid #fff}.bi-color-picker-editor .color-picker-editor-display{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;box-shadow:0 0 2px 1px #d4dadd inset;-webkit-box-shadow:0 0 2px 1px #d4dadd inset;-moz-box-shadow:0 0 2px 1px #d4dadd inset}.farbtastic{position:relative}.farbtastic *{position:absolute;cursor:crosshair}.farbtastic,.farbtastic .wheel{width:195px;height:195px}.farbtastic .color,.farbtastic .overlay{top:47px;left:47px;width:101px;height:101px}.farbtastic .wheel{width:195px;height:195px}.farbtastic .marker{width:17px;height:17px;margin:-8px 0 0 -8px;overflow:hidden}.bi-bubble-combo .bubble-combo-triangle-left,.bi-bubble-combo .bubble-combo-triangle-right{z-index:1;width:0;height:0;border-top:6px solid transparent;border-bottom:6px solid transparent}.bi-bubble-combo .button-combo-triangle-wrapper{position:fixed!important}.bi-bubble-combo .bubble-combo-triangle-left{border-left:6px solid #3f8ce8}.bi-bubble-combo .bubble-combo-triangle-right{border-right:6px solid #3f8ce8}.bi-bubble-combo .bubble-combo-triangle-bottom,.bi-bubble-combo .bubble-combo-triangle-top{width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;z-index:1}.bi-bubble-combo .bubble-combo-triangle-top{border-top:6px solid #3f8ce8}.bi-bubble-combo .bubble-combo-triangle-bottom{border-bottom:6px solid #3f8ce8}.bi-bubble-popup-view{-webkit-box-shadow:0 0 10px rgba(0,0,0,.2);-moz-box-shadow:0 0 10px rgba(0,0,0,.2);box-shadow:0 0 10px rgba(0,0,0,.2)}.bi-adapt-editor .adapt-editor-text{font-size:14px}.bi-search-editor .close-font,.bi-search-editor .search-font{font-size:20px}.bi-small-search-editor .bi-editor,.bi-small-search-editor .bi-editor .bi-input,.bi-small-search-editor .bi-editor .bi-label{font-size:12px}.bi-small-search-editor .close-font,.bi-small-search-editor .search-font{font-size:18px}.bi-sign-initial-editor .sign-initial-editor-text{font-size:14px}.CodeMirror{font-family:monospace;cursor:text;width:100%;height:100%}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:#000}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #1a1a1a}.bi-theme-dark .CodeMirror div.CodeMirror-cursor{border-left:1px solid #fff}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7}.CodeMirror.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}@-moz-keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}@-webkit-keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}@keyframes blink{0%,100%{background:#7e7}50%{background:0 0}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-ruler{border-left:1px solid #ccc;position:absolute}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.bi-display-tree .ztree li a:hover,.ztree li a{text-decoration:none}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta,.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default span[class*=fieldName]{display:inline-block;color:#fff;background:#3f8ce8;padding:0 5px;margin:1px}.cm-s-default span[class*=start]{-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;margin-left:3px}.cm-s-default span[class*=end]{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0;margin-right:3px}.cm-s-default span[class*="start end"]{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.cm-s-default span[class*="#"]{color:#3f8ce8}.cm-invalidchar,.cm-s-default .cm-error{color:red}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-matchingtag{background:rgba(255,150,0,.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden}.CodeMirror-scroll{overflow:scroll!important;margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative;border-right:30px solid transparent}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;margin-bottom:-30px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;height:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none}.bi-message-text,.bi-page-table-cell{-webkit-user-select:text;-ms-user-select:text;-o-user-select:text;-khtml-user-select:text}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent}.codemirror-high-line-height{line-height:2}.codemirror-low-line-height{line-height:1.4}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-code{outline:0}.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber,.CodeMirror-scroll,.CodeMirror-sizer{-moz-box-sizing:content-box;box-sizing:content-box}.bi-collection-table-cell,.bi-text{-webkit-box-sizing:border-box;-ms-box-sizing:border-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;border-right:none;width:0}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}span.CodeMirror-selectedtext{background:0 0}.CodeMirror-hints{position:absolute;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,.2);box-shadow:2px 3px 5px rgba(0,0,0,.2);border-radius:3px;border:1px solid silver;background:#fff;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto;z-index:1000000000}.bi-label,.bi-segment>.center-element,.bi-text,.bi-textarea-editor{overflow-x:hidden;overflow-y:hidden}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;max-width:19em;overflow:hidden;white-space:pre;color:#000;cursor:pointer}.bi-label,.bi-text,.ztree li{white-space:nowrap}li.CodeMirror-hint-active{background:#08f;color:#fff}.bi-message-title{font-size:16px;cursor:pointer}.bi-message-text{font-size:16px;-moz-user-select:text;user-select:text}.bi-message-content{font-size:16px}.bi-message-close{font-size:25px}.bi-multi-list-view .bi-button-mask{opacity:.1;filter:alpha(opacity=10)}.bi-panel{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-panel .panel-title .panel-title-text{cursor:text;font-size:14px}.bi-all-count-pager .all-pager-next,.bi-all-count-pager .all-pager-prev,.bi-direction-pager .direction-pager-next,.bi-direction-pager .direction-pager-prev,.bi-rich-editor-text-toolbar .text-toolbar-button{font-size:16px}.bi-pager .page-item{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-segment>.center-element{overflow:hidden;background:#fff;border-right:1px solid #d4dadd;border-top:1px solid #d4dadd;border-bottom:1px solid #d4dadd}.bi-segment>.first-element{border-left:1px solid #d4dadd;-webkit-border-radius:6px 0 0 6px;-moz-border-radius:6px 0 0 6px;border-radius:6px 0 0 6px}.bi-segment>.last-element{-webkit-border-radius:0 6px 6px 0;-moz-border-radius:0 6px 6px 0;border-radius:0 6px 6px 0}.bi-theme-dark .bi-segment>.center-element{overflow:hidden;overflow-x:hidden;overflow-y:hidden;background:#242640;border-right:1px solid #525466;border-top:1px solid #525466;border-bottom:1px solid #525466}.bi-theme-dark .bi-segment>.first-element{border-left:1px solid #242640}#body .bi-button,body .bi-button{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;border:1px solid #178cdf;background-color:#3f8ce8;text-align:center;vertical-align:middle;cursor:pointer;font-size:14px}#body .bi-button.block,body .bi-button.block{font-size:inherit;border-width:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}#body .bi-button.clear,body .bi-button.clear{font-size:inherit;border-width:0;background-color:transparent}#body .bi-button.clear:active,#body .bi-button.clear:hover,body .bi-button.clear:active,body .bi-button.clear:hover{opacity:.75;filter:alpha(opacity=75)}#body .bi-button.button-common,#body .bi-button.button-common .b-font:before,body .bi-button.button-common,body .bi-button.button-common .b-font:before{color:#fff}#body .bi-button.button-common.clear,#body .bi-button.button-common.clear .b-font:before,body .bi-button.button-common.clear,body .bi-button.button-common.clear .b-font:before{color:#3f8ce8}#body .bi-button.button-ignore,body .bi-button.button-ignore{background-color:#fff;border-color:#d4dadd}#body .bi-button.button-ignore,#body .bi-button.button-ignore .b-font:before,body .bi-button.button-ignore,body .bi-button.button-ignore .b-font:before{color:#1a1a1a}#body .bi-button.button-ignore.clear,body .bi-button.button-ignore.clear{background-color:transparent;border-width:0}#body .bi-button.button-success,body .bi-button.button-success{background-color:#58cc7d;border-color:#58cc7d}#body .bi-button.button-success,#body .bi-button.button-success .b-font:before,body .bi-button.button-success,body .bi-button.button-success .b-font:before{color:#fff}#body .bi-button.button-success.clear,body .bi-button.button-success.clear{background-color:transparent;border-width:0}#body .bi-button.button-success.clear,#body .bi-button.button-success.clear .b-font:before,body .bi-button.button-success.clear,body .bi-button.button-success.clear .b-font:before{color:#0c6d23}#body .bi-button.button-warning,body .bi-button.button-warning{background-color:#e85050;border-color:#e85050}#body .bi-button.button-warning,#body .bi-button.button-warning .b-font:before,body .bi-button.button-warning,body .bi-button.button-warning .b-font:before{color:#fff}#body .bi-button.button-warning.clear,body .bi-button.button-warning.clear{background-color:transparent;border-width:0}#body .bi-button.button-warning.clear,#body .bi-button.button-warning.clear .b-font:before,body .bi-button.button-warning.clear,body .bi-button.button-warning.clear .b-font:before{color:#e85050}#body .bi-button.button-common.disabled,#body .bi-button.button-common.disabled.base-disabled,#body .bi-button.button-success.disabled,#body .bi-button.button-success.disabled.base-disabled,#body .bi-button.button-warning.disabled,#body .bi-button.button-warning.disabled.base-disabled,body .bi-button.button-common.disabled,body .bi-button.button-common.disabled.base-disabled,body .bi-button.button-success.disabled,body .bi-button.button-success.disabled.base-disabled,body .bi-button.button-warning.disabled,body .bi-button.button-warning.disabled.base-disabled{background:#ccc!important;border-color:#ccc!important}#body .bi-button.button-common.disabled,#body .bi-button.button-common.disabled .b-font:before,#body .bi-button.button-common.disabled.base-disabled,#body .bi-button.button-common.disabled.base-disabled .b-font:before,#body .bi-button.button-success.disabled,#body .bi-button.button-success.disabled .b-font:before,#body .bi-button.button-success.disabled.base-disabled,#body .bi-button.button-success.disabled.base-disabled .b-font:before,#body .bi-button.button-warning.disabled,#body .bi-button.button-warning.disabled .b-font:before,#body .bi-button.button-warning.disabled.base-disabled,#body .bi-button.button-warning.disabled.base-disabled .b-font:before,body .bi-button.button-common.disabled,body .bi-button.button-common.disabled .b-font:before,body .bi-button.button-common.disabled.base-disabled,body .bi-button.button-common.disabled.base-disabled .b-font:before,body .bi-button.button-success.disabled,body .bi-button.button-success.disabled .b-font:before,body .bi-button.button-success.disabled.base-disabled,body .bi-button.button-success.disabled.base-disabled .b-font:before,body .bi-button.button-warning.disabled,body .bi-button.button-warning.disabled .b-font:before,body .bi-button.button-warning.disabled.base-disabled,body .bi-button.button-warning.disabled.base-disabled .b-font:before{color:#fff!important}#body .bi-button.button-common.disabled.clear,#body .bi-button.button-common.disabled.clear .b-font:before,#body .bi-button.button-ignore.disabled,#body .bi-button.button-ignore.disabled .b-font:before,#body .bi-button.button-ignore.disabled.clear,#body .bi-button.button-ignore.disabled.clear .b-font:before,#body .bi-button.button-success.disabled.clear,#body .bi-button.button-success.disabled.clear .b-font:before,#body .bi-button.button-warning.disabled.clear,#body .bi-button.button-warning.disabled.clear .b-font:before,body .bi-button.button-common.disabled.clear,body .bi-button.button-common.disabled.clear .b-font:before,body .bi-button.button-ignore.disabled,body .bi-button.button-ignore.disabled .b-font:before,body .bi-button.button-ignore.disabled.clear,body .bi-button.button-ignore.disabled.clear .b-font:before,body .bi-button.button-success.disabled.clear,body .bi-button.button-success.disabled.clear .b-font:before,body .bi-button.button-warning.disabled.clear,body .bi-button.button-warning.disabled.clear .b-font:before{color:#ccc!important}#body .bi-button.button-ignore.disabled,body .bi-button.button-ignore.disabled{background:#fff!important;border-color:#d4dadd!important}#body .bi-button.button-common.disabled.clear,#body .bi-button.button-ignore.disabled.clear,#body .bi-button.button-success.disabled.clear,#body .bi-button.button-warning.disabled.clear,body .bi-button.button-common.disabled.clear,body .bi-button.button-ignore.disabled.clear,body .bi-button.button-success.disabled.clear,body .bi-button.button-warning.disabled.clear{background:0 0!important;border-width:0!important}#body .bi-button.button-common.disabled.clear:active,#body .bi-button.button-common.disabled.clear:hover,#body .bi-button.button-ignore.disabled.clear:active,#body .bi-button.button-ignore.disabled.clear:hover,#body .bi-button.button-success.disabled.clear:active,#body .bi-button.button-success.disabled.clear:hover,#body .bi-button.button-warning.disabled.clear:active,#body .bi-button.button-warning.disabled.clear:hover,body .bi-button.button-common.disabled.clear:active,body .bi-button.button-common.disabled.clear:hover,body .bi-button.button-ignore.disabled.clear:active,body .bi-button.button-ignore.disabled.clear:hover,body .bi-button.button-success.disabled.clear:active,body .bi-button.button-success.disabled.clear:hover,body .bi-button.button-warning.disabled.clear:active,body .bi-button.button-warning.disabled.clear:hover{opacity:1;filter:alpha(opacity=100)}.bi-basic-button.button-common .bi-button-mask,.bi-basic-button.button-success .bi-button-mask,.bi-basic-button.button-warning .bi-button-mask{opacity:.2;filter:alpha(opacity=20);background-color:#fff}.bi-basic-button .bi-button-mask{opacity:.2;filter:alpha(opacity=20);background-color:#1a1a1a}.bi-single-select-icon-text-item.active .b-font:before,.bi-single-select-icon-text-item:active .b-font:before{color:#3f8ce8}.bi-code-editor .param{color:#fff;padding:0 5px;margin:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#3f8ce8;display:inline-block}.bi-code-editor .error-param{color:#e85050;padding:0 5px;margin:1px;display:inline-block}.bi-editor{font-size:12px}.bi-multifile-editor .multifile-editor{text-align:right;cursor:pointer;font-size:100px;z-index:2}.bi-resizable-table .resizable-table-region-resizer,.bi-resizable-table-cell .resizable-table-cell-resizer-container{cursor:ew-resize;z-index:1}.bi-shelter-editor .shelter-editor-text,.bi-sign-editor .sign-editor-text{font-size:12px}.bi-textarea-editor{overflow:hidden}.bi-textarea-editor .textarea-editor-content{font-size:12px;border:none}.bi-bubble,.bi-toast{font-size:14px}.bi-file{opacity:0;filter:alpha(opacity=0);z-index:2}.bi-input,.bi-textarea{border:none;outline:0;background-color:transparent;padding:0;margin:0;width:100%;height:100%}.bi-input.bi-input-focus,.bi-textarea.bi-input-focus{border:none}.bi-input.bi-input-error,.bi-textarea.bi-input-error{border:none;color:#e85050!important}.bi-bubble .bubble-text,.bi-toast{-webkit-border-radius:2px;-moz-border-radius:2px}.bi-label{word-break:break-all}.bi-text{box-sizing:border-box;word-wrap:break-word;word-break:break-word}.bi-bubble .bubble-text{border-radius:2px;background:#fddddd;color:#e85050}.bi-tip{position:fixed!important}.bi-toast{border-radius:2px}.bi-toast.toast-success{background:#e1f4e7;color:#0c6d23}.bi-toast.toast-warning{background:#fddddd;color:#e85050}.bi-tooltip{max-width:250px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;font-size:12px}.bi-tooltip.tooltip-success{background:#fff5c1;border:1px solid #fff5c1;color:#1a1a1a}.bi-tooltip.tooltip-warning{background:#fddddd;color:#e85050;border:1px solid #f4cbcb}.bi-table>div.bottom-left>div>div>table,.bi-table>div.bottom-right>div>div>table,.bi-table>div.top-left>div>div>table,.bi-table>div.top-right>div>div>table,.bi-table>div>div>table{border-right:1px solid #d4dadd;border-bottom:1px solid #d4dadd}.bi-collection-table-cell{box-sizing:border-box}.bi-grid-table-cell,.bi-sequence-table-dynamic-number .sequence-table-title-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box}.bi-collection-table-cell.first-row{border-top:1px solid #d4dadd}.bi-collection-table-cell.first-col{border-left:1px solid #d4dadd}.bi-theme-dark .bi-collection-table-cell.first-row{border-top:1px solid #525466}.bi-theme-dark .bi-collection-table-cell.first-col{border-left:1px solid #525466}.bi-quick-collection-table>div>.bi-collection{overflow:hidden!important;overflow-x:hidden!important;overflow-y:hidden!important}.bi-table>.first-col{border-left:none}.bi-table>.first-row{border-top:none}.bi-theme-dark .bi-table>div.bottom-left>div>div>table,.bi-theme-dark .bi-table>div.bottom-right>div>div>table,.bi-theme-dark .bi-table>div.top-left>div>div>table,.bi-theme-dark .bi-table>div.top-right>div>div>table,.bi-theme-dark .bi-table>div>div>table{border-right:1px solid #525466;border-bottom:1px solid #525466}.bi-table>div>div>div>table,.bi-table>div>div>table{min-width:100%;clear:both;border-spacing:0;border-collapse:separate}.bi-table>div>div>div>table,.bi-table>div>div>div>table>*>*>td,.bi-table>div>div>div>table>*>*>th,.bi-table>div>div>table,.bi-table>div>div>table>*>*>td,.bi-table>div>div>table>*>*>th{vertical-align:middle;margin:0;padding:0}.bi-table>div>div>div>table>tbody>tr>td,.bi-table>div>div>div>table>thead>tr>td,.bi-table>div>div>table>tbody>tr>td,.bi-table>div>div>table>thead>tr>td{border-top:1px solid #d4dadd;border-left:1px solid #d4dadd}.bi-theme-dark .bi-table>div>div>div>table>tbody>tr>td,.bi-theme-dark .bi-table>div>div>div>table>thead>tr>td,.bi-theme-dark .bi-table>div>div>table>tbody>tr>td,.bi-theme-dark .bi-table>div>div>table>thead>tr>td{border-top:1px solid #525466;border-left:1px solid #525466}.bi-grid-table-cell{box-sizing:border-box}.bi-grid-table-cell.first-row{border-top:1px solid #d4dadd}.bi-grid-table-cell.first-col{border-left:1px solid #d4dadd}.bi-theme-dark .bi-grid-table-cell.first-row{border-top:1px solid #525466}.bi-theme-dark .bi-grid-table-cell.first-col{border-left:1px solid #525466}.scrollbar-layout-main{box-sizing:border-box;outline:0;overflow:hidden;position:absolute;transition-duration:250ms;transition-timing-function:ease;user-select:none;background-color:rgba(102,102,102,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666, endColorstr=#0d666666);border-radius:5px}.bi-theme-dark .scrollbar-layout-main{background-color:rgba(204,204,204,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc, endColorstr=#0dcccccc)}.scrollbar-layout-main-vertical{bottom:0;right:0;top:0;transition-property:background-color;width:10px}.scrollbar-layout-main-vertical.public-scrollbar-main-active,.scrollbar-layout-main-vertical:hover{width:10px}.scrollbar-layout-main-horizontal{bottom:0;height:10px;left:0;transition-property:background-color;background-color:rgba(102,102,102,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666, endColorstr=#0d666666)}.bi-theme-dark .scrollbar-layout-main-horizontal{background-color:rgba(204,204,204,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc, endColorstr=#0dcccccc)}.scrollbar-layout-main-horizontal.public-scrollbar-main-active,.scrollbar-layout-main-horizontal:hover{height:10px}.scrollbar-layout-face{left:0;overflow:hidden;position:absolute;z-index:1}.scrollbar-layout-face:after{border-radius:6px;display:block;position:absolute;transition:background-color 250ms ease}.scrollbar-layout-face-horizontal{bottom:0;left:0;top:0}.scrollbar-layout-face-horizontal:after{bottom:2px;left:0;top:2px;width:100%}.scrollbar-layout-face-vertical{left:0;right:0;top:0}.scrollbar-layout-face-vertical:after{height:100%;left:2px;right:2px;top:0}.public-scrollbar-face:after{background-color:rgba(102,102,102,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666, endColorstr=#4d666666)}.bi-theme-dark .public-scrollbar-face:after{background-color:rgba(204,204,204,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc, endColorstr=#4dcccccc)}.public-scrollbar-face-active:after,.public-scrollbar-main-active .public-scrollbar-face:after,.public-scrollbar-main:hover .public-scrollbar-face:after{background-color:rgba(102,102,102,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666, endColorstr=#b3666666)}.bi-theme-dark .public-scrollbar-face-active:after,.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after{background-color:rgba(204,204,204,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc, endColorstr=#b3cccccc)}.horizontal-scrollbar{bottom:0;position:absolute}.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob,.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob{background-color:#3f8ce8}.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob{background-color:#58cc7d}.bi-resizable-table .resizable-table-resizer{cursor:ew-resize;z-index:1;background-color:#3f8ce8}.bi-resizable-table .resizable-table-resizer.suitable{background-color:#58cc7d}.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob,.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob{background-color:#3f8ce8}.bi-branch-tree .bi-branch-tree-view{min-width:300px}.bi-display-tree .ztree *{color:#999}.bi-display-tree .ztree li a,.bi-display-tree .ztree li span{cursor:default!important}.ztree li a,.ztree li span.button{cursor:pointer;display:inline-block}.bi-display-tree .ztree li a.curSelectedNode{padding-top:1px;border:none;background-color:inherit;opacity:1;filter:alpha(opacity=100)}.ztree li a.tmpTargetNode_inner,ul.tmpTargetzTree,ul.ztree.zTreeDragUL{opacity:.8;filter:alpha(opacity=80)}.ztree *{padding:0;margin:0}.ztree{margin:0;padding:5px}.ztree li{padding:0;margin:0;list-style:none;line-height:14px;text-align:left;outline:0}.ztree li ul{margin:0;padding:0 0 0 18px}.ztree li a{padding:1px 3px 0 0;margin:0;height:24px;background-color:transparent;vertical-align:top}.ztree li a.curSelectedNode_Edit{padding-top:0;background-color:#FFE6B0;color:#000;height:16px;border:1px solid #FFB951;opacity:.8}.ztree li a.tmpTargetNode_inner{padding-top:0;background-color:#316AC5;color:#fff;height:16px;border:1px solid #316AC5}.ztree li a input.rename{height:14px;width:80px;padding:0;margin:0;font-size:12px;border:1px solid #7EC4CC}.ztree li span{line-height:24px;margin-right:2px}.ztree li span.button{line-height:0;margin:0;width:16px;height:16px;vertical-align:middle;border:0;outline:0;background-color:transparent;background-repeat:no-repeat;background-attachment:scroll}.bi-popup-view .list-view-toolbar,.bi-year-popup .year-popup-navigation{line-height:30px}.ztree li span.button.chk{width:16px;height:16px;margin:0 3px 0 0;cursor:auto}.ztree li span.button.chk.checkbox_false_disable{background-position:0 -56px}.ztree li span.button.chk.checkbox_true_disable{background-position:-14px -56px}.ztree li span.button.chk.radio_false_full{background-position:-28px 0}.ztree li span.button.chk.radio_false_full_focus{background-position:-28px -14px}.ztree li span.button.chk.radio_false_part{background-position:-28px -28px}.ztree li span.button.chk.radio_false_part_focus{background-position:-28px -42px}.ztree li span.button.chk.radio_false_disable{background-position:-28px -56px}.ztree li span.button.chk.radio_true_full{background-position:-42px 0}.ztree li span.button.chk.radio_true_full_focus{background-position:-42px -14px}.ztree li span.button.chk.radio_true_part{background-position:-42px -28px}.ztree li span.button.chk.radio_true_part_focus{background-position:-42px -42px}.ztree li span.button.chk.radio_true_disable{background-position:-42px -56px}.ztree li span.button.switch{width:25px;height:25px}.ztree li span.button.noline_open{background-position:-92px -72px}.ztree li span.button.noline_close{background-position:-74px -72px}.ztree li span.button.noline_docu,.ztree li span.button.root_docu{background:0 0}.ztree li span.button.ico_open{margin-right:2px;background-position:-110px -16px;vertical-align:top}.ztree li span.button.ico_close{margin-right:2px;background-position:-110px 0;vertical-align:top}.ztree li span.button.ico_docu{margin-right:2px;background-position:-110px -32px;vertical-align:top}.ztree li span.button.edit{margin-right:2px;background-position:-110px -48px;vertical-align:top}.ztree li span.button.remove{margin-right:2px;background-position:-110px -64px;vertical-align:top}.ztree li span.button.ico_loading{width:0;margin-right:2px;vertical-align:top}ul.tmpTargetzTree{background-color:#FFE6B0}span.tmpzTreeMove_arrow{width:16px;height:16px;display:inline-block;padding:0;margin:2px 0 0 1px;border:0;position:absolute;background-color:transparent;background-repeat:no-repeat;background-attachment:scroll;background-position:-110px -80px}.zTreeMask,ul.ztree.zTreeDragUL{background-color:#cfcfcf;position:absolute}ul.ztree.zTreeDragUL{margin:0;padding:0;width:auto;height:auto;overflow:hidden;border:1px dotted #00B83F}body,html{height:100%}.zTreeMask{z-index:10000;opacity:0;filter:alpha(opacity=0)}.bi-trigger .bi-trigger-icon-button{font-size:16px}.bi-select-text-trigger,.bi-small-select-text-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-date-trigger,.bi-popup-view .list-view-outer{-webkit-border-radius:2px;-moz-border-radius:2px}.bi-popup-view{position:fixed!important;overflow-y:visible!important;overflow-x:visible!important;overflow:visible!important;cursor:default}.bi-popup-view .list-view-outer{border-radius:2px}.bi-popup-view .list-view-toolbar>.center-element{border-left:1px solid #d4dadd}.bi-popup-view .list-view-toolbar>.first-element{border-left:none}.bi-theme-dark .bi-popup-view .list-view-toolbar>.center-element{border-left:1px solid #525466}.bi-theme-dark .bi-popup-view .list-view-toolbar>.first-element{border-left:none}.bi-arrangement .arrangement-helper{background:#3f8ce8;z-index:1000000000}.bi-arrangement .arrangement-block,.bi-arrangement .arrangement-drop-container{z-index:1000000000}.bi-arrangement .arrangement-drop-container .arrangement-drop-region{overflow:hidden}.bi-arrangement .arrangement-drop-container .bottom-center,.bi-arrangement .arrangement-drop-container .bottom-center-second,.bi-arrangement .arrangement-drop-container .bottom-left,.bi-arrangement .arrangement-drop-container .bottom-left-second,.bi-arrangement .arrangement-drop-container .bottom-right,.bi-arrangement .arrangement-drop-container .bottom-right-second,.bi-arrangement .arrangement-drop-container .drop-devider,.bi-arrangement .arrangement-drop-container .left-center,.bi-arrangement .arrangement-drop-container .left-center-second,.bi-arrangement .arrangement-drop-container .right-center,.bi-arrangement .arrangement-drop-container .right-center-second,.bi-arrangement .arrangement-drop-container .top-center,.bi-arrangement .arrangement-drop-container .top-center-second,.bi-arrangement .arrangement-drop-container .top-left,.bi-arrangement .arrangement-drop-container .top-left-second,.bi-arrangement .arrangement-drop-container .top-right,.bi-arrangement .arrangement-drop-container .top-right-second{z-index:1000000001;background:#3f8ce8}.bi-arrangement-droppable{z-index:100000}.bi-date-trigger{border-radius:2px}.bi-down-list-popup .bi-down-list-item .list-item-text,.bi-down-list-popup .list-group-item-text{max-width:203px}.bi-excel-table>div.bottom-right>div>div>table{border-right:1px solid #d4dadd}.bi-theme-dark .bi-excel-table>div.bottom-right>div>div>table{border-right:1px solid #525466}.bi-file-manager-nav-button .file-manager-nav-button-text{max-width:200px}.bi-file-manager-nav-button .file-manager-nav-button-text.active{background-color:#eff1f4;color:#999}.bi-file-manager-nav-button .file-manager-nav-button-triangle{z-index:1}.bi-theme-dark .bi-file-manager-nav-button .file-manager-nav-button-text.active{background-color:#191b2b;color:#999}.bi-interactive-arrangement .interactive-arrangement-dragtag-line{z-index:1000000000;background-color:#f07d0a}.bi-interactive-arrangement .interactive-arrangement-dragtag-icon{z-index:1000000000}.bi-interval-slider{min-height:70px}.bi-interval-slider-label{min-height:50px}.bi-month-trigger,.bi-multidate-combo{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-multidate-popup .multidate-popup-label{color:#3f8ce8;font-size:14px}.bi-multidate-popup .multidate-popup-item.active,.bi-multidate-popup .multidate-popup-item:active{background-color:#3f8ce8;color:#fff;-webkit-border-radius:2px 2px 0 0;-moz-border-radius:2px 2px 0 0;border-radius:2px 2px 0 0}.bi-multidate-popup .multidate-popup-button{color:#3f8ce8;font-size:14px}.bi-multidate-segment .bi-multidate-editor{font-size:14px}.bi-multi-select-combo .multi-select-trigger-icon-button,.bi-multi-select-insert-combo .multi-select-trigger-icon-button,.bi-multi-tree-combo .multi-select-trigger-icon-button{font-size:16px}.bi-multi-select-check-pane .multi-select-check-selected{text-decoration:underline}.bi-multi-select-trigger{-webkit-border-radius:2px 2px 2px 2px;-moz-border-radius:2px;border-radius:2px}.bi-number-editor,.bi-quarter-trigger{-webkit-border-radius:2px;-moz-border-radius:2px}.bi-multi-select-search-pane .multi-select-toolbar{color:#e85050}.bi-multi-select-check-selected-button{z-index:1}.bi-multi-tree-check-pane .multi-tree-check-selected{color:#3f8ce8}.bi-number-interval .number-interval-big-combo .bi-icon-combo-trigger .icon-combo-trigger-icon,.bi-number-interval .number-interval-small-combo .bi-icon-combo-trigger .icon-combo-trigger-icon{font-size:14px}.bi-multi-tree-popup .popup-view-tree{min-height:170px}.bi-preview-table-cell,.bi-preview-table-header-cell{min-height:25px;min-width:80px;max-width:220px}.bi-multi-tree-check-selected-button .trigger-check-selected{color:#3f8ce8;z-index:1}.bi-number-editor{border-radius:2px}.bi-number-interval .number-interval-small-editor{-moz-border-radius-topleft:2px;-webkit-border-top-left-radius:2px;-moz-border-radius-bottomleft:2px;-webkit-border-bottom-left-radius:2px;border-top-left-radius:2px;border-bottom-left-radius:2px}.bi-number-interval .number-interval-big-editor{-moz-border-radius-topright:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-bottomright:2px;-webkit-border-bottom-right-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px}.bi-number-interval .number-interval-big-combo{-moz-border-radius-topleft:2px;-webkit-border-top-left-radius:2px;-moz-border-radius-bottomleft:2px;-webkit-border-bottom-left-radius:2px;border-top-left-radius:2px;border-bottom-left-radius:2px}.bi-number-interval .number-interval-small-combo{-moz-border-radius-topright:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-bottomright:2px;-webkit-border-bottom-right-radius:2px;border-top-right-radius:2px;border-bottom-right-radius:2px}.bi-number-interval.number-error .bi-input{color:#e85050!important}.bi-page-table-cell{-moz-user-select:text;user-select:text}.bi-path-chooser .path-chooser-radio,.bi-path-region .path-region-label{z-index:1}.bi-preview-table{-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;-o-user-select:text;user-select:text}.bi-preview-table>div>div>div>table>thead>tr.odd,.bi-preview-table>div>table>thead>tr.odd{background-color:#eff1f4}.bi-theme-dark .bi-preview-table>div>div>div>table>thead>tr.odd,.bi-theme-dark .bi-preview-table>div>table>thead>tr.odd{background-color:#191b2b}.bi-quarter-trigger{border-radius:2px}.bi-relation-view-region .relation-view-region-container{z-index:1;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.bi-relation-view-region .relation-view-region-container.other-package{border-style:dashed}.bi-sequence-table-dynamic-number .sequence-table-title-cell{overflow:hidden;overflow-x:hidden;overflow-y:hidden;box-sizing:border-box}.bi-sequence-table-dynamic-number .sequence-table-number-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-list-number .sequence-table-title-cell{overflow:hidden;overflow-x:hidden;overflow-y:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-list-number .sequence-table-number-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-tree-number .sequence-table-title-cell{overflow:hidden;overflow-x:hidden;overflow-y:hidden;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-sequence-table-tree-number .sequence-table-number-cell{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box}.bi-single-slider-label{min-height:50px}.bi-single-slider-normal{min-height:30px}.bi-single-slider{min-height:50px}.bi-single-slider-button .slider-button{cursor:ew-resize;-webkit-box-shadow:0 0 10px rgba(0,0,0,.2);-moz-box-shadow:0 0 10px rgba(0,0,0,.2);box-shadow:0 0 10px rgba(0,0,0,.2);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.bi-slider-track .gray-track{background-color:rgba(153,153,153,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d999999, endColorstr=#4d999999);-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.bi-slider-track .blue-track{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.bi-param-time-interval.time-error .bi-input,.bi-param-time-interval.time-error .sign-editor-text{color:#e85050}.bi-year-popup .year-popup-navigation>.center-element{border-left:1px solid #d4dadd}.bi-year-popup .year-popup-navigation>.first-element{border-left:none}.bi-theme-dark .bi-year-popup .year-popup-navigation>.center-element{border-left:1px solid #525466}.bi-theme-dark .bi-year-popup .year-popup-navigation>.first-element{border-left:none}.bi-year-trigger{-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}*,button,html,input,select,textarea{font-family:"Microsoft YaHei","Hiragino Sans GB W3"}html{overflow:hidden}body{position:absolute;width:100%;margin:0;padding:0;top:0;left:0;background-repeat:repeat;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;color:#666;font:400 12px "Microsoft YaHei","Hiragino Sans GB W3";-webkit-font-smoothing:antialiased;text-decoration:none;-kthml-user-focus:normal;-moz-user-focus:normal;-moz-outline:0 none;outline:0}div::-webkit-scrollbar,textarea::-webkit-scrollbar{-webkit-appearance:none;background-color:rgba(102,102,102,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666, endColorstr=#0d666666);width:6px;height:6px}div::-webkit-scrollbar-thumb,textarea::-webkit-scrollbar-thumb{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background-color:rgba(102,102,102,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666, endColorstr=#4d666666)}div::-webkit-scrollbar-thumb:hover,textarea::-webkit-scrollbar-thumb:hover{background-color:rgba(102,102,102,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666, endColorstr=#b3666666)}.bi-theme-dark div::-webkit-scrollbar,.bi-theme-dark textarea::-webkit-scrollbar{-webkit-appearance:none;background-color:rgba(204,204,204,.05);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc, endColorstr=#0dcccccc);width:6px;height:6px}.bi-theme-dark div::-webkit-scrollbar-thumb,.bi-theme-dark textarea::-webkit-scrollbar-thumb{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background-color:rgba(204,204,204,.3);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc, endColorstr=#4dcccccc)}.bi-theme-dark div::-webkit-scrollbar-thumb:hover,.bi-theme-dark textarea::-webkit-scrollbar-thumb:hover{background-color:rgba(204,204,204,.7);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc, endColorstr=#b3cccccc)}.base-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-1.png) repeat-y}.bi-theme-dark .base-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-1.png) repeat-y}.first-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-2.png) center center no-repeat}.bi-theme-dark .first-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-2.png) center center no-repeat}.mid-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-3.png) center center no-repeat}.bi-theme-dark .mid-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-3.png) center center no-repeat}.last-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-4.png) center center no-repeat}.bi-theme-dark .last-line-conn-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-4.png) center center no-repeat}.loading-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/loading.gif) center center no-repeat}.auto-color-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/background/auto-color.png) center center no-repeat}.trans-color-background{background:url(https://fanruan.coding.me/fineui/dist/images/1x/background/trans-color.png) center center no-repeat}@font-face{font-family:bi;src:url(https://fanruan.coding.me/fineui/dist/font/iconfont.eot),url(https://fanruan.coding.me/fineui/dist/font/iconfont.woff) format('woff'),url(https://fanruan.coding.me/fineui/dist/font/iconfont.ttf) format('truetype'),url(https://fanruan.coding.me/fineui/dist/font/iconfont.svg#svgFontName) format('svg')}@font-face{font-family:bi;src:url(https://fanruan.coding.me/fineui/dist/font/iconfont.eot)}.b-font{font-family:bi;font-style:normal;-webkit-font-smoothing:antialiased}.close-font .b-font:before,.close-font.disabled .b-font:before,.close-font.native .b-font:before,.close-h-font .b-font:before,.close-h-font.disabled .b-font:before,.close-h-font.hover .b-font:before,.close-h-font.native .b-font:before,.close-h-font:focus .b-font:before,.close-h-font:hover .b-font:before,.close-ha-font .b-font:before,.close-ha-font.hover .b-font:before,.close-ha-font:focus .b-font:before,.close-ha-font:hover .b-font:before{content:"\e600";color:inherit}.close-ha-font.active .b-font:before,.close-ha-font:active .b-font:before{content:"\e600";color:#3f8ce8}.close-ha-font.disabled .b-font:before,.close-ha-font.native .b-font:before,.search-close-h-font .b-font:before{content:"\e600";color:inherit}.search-close-h-font.hover .b-font:before,.search-close-h-font:focus .b-font:before,.search-close-h-font:hover .b-font:before{content:"\e600";color:#e85050}.search-close-h-font.disabled .b-font:before,.search-close-h-font.native .b-font:before{content:"\e600";color:inherit}.pre-page-h-font .b-font:before,.pre-page-h-font.disabled .b-font:before,.pre-page-h-font.hover .b-font:before,.pre-page-h-font.native .b-font:before,.pre-page-h-font:focus .b-font:before,.pre-page-h-font:hover .b-font:before{content:"\e601";color:inherit}.next-page-h-font .b-font:before,.next-page-h-font.disabled .b-font:before,.next-page-h-font.hover .b-font:before,.next-page-h-font.native .b-font:before,.next-page-h-font:focus .b-font:before,.next-page-h-font:hover .b-font:before{content:"\e602";color:inherit}.search-font .b-font:before,.search-font.disabled .b-font:before,.search-font.native .b-font:before{content:"\e604";color:inherit}.dot-font .b-font:before,.dot-font.disabled .b-font:before,.dot-font.native .b-font:before,.dot-h-font .b-font:before{content:"\e606";color:#1a1a1a}.dot-h-font.hover .b-font:before,.dot-h-font:focus .b-font:before,.dot-h-font:hover .b-font:before{content:"\e606";color:inherit}.dot-h-font.disabled .b-font:before,.dot-h-font.native .b-font:before{content:"\e606";color:#1a1a1a}.dot-ha-font .b-font:before{content:"\e606";color:#fff}.dot-ha-font.hover .b-font:before,.dot-ha-font:focus .b-font:before,.dot-ha-font:hover .b-font:before{content:"\e606";color:#999}.dot-ha-font.active .b-font:before,.dot-ha-font:active .b-font:before{content:"\e606";color:#1a1a1a}.dot-e-font .b-font:before,.dot-ha-font.disabled .b-font:before,.dot-ha-font.native .b-font:before{content:"\e606";color:#fff}.dot-e-font.hover .b-font:before,.dot-e-font:focus .b-font:before,.dot-e-font:hover .b-font:before{content:"\e606";color:#999}.dot-e-font.active .b-font:before{content:"\e606";color:#1a1a1a}.dot-e-font:active .b-font:before{content:"\e606";color:#3f8ce8}.dot-e-font.disabled .b-font:before,.dot-e-font.native .b-font:before{content:"\e606";color:#fff}.pull-right-font .b-font:before,.pull-right-font.disabled .b-font:before,.pull-right-font.native .b-font:before,.pull-right-h-font .b-font:before,.pull-right-h-font.disabled .b-font:before,.pull-right-h-font.hover .b-font:before,.pull-right-h-font.native .b-font:before,.pull-right-h-font:focus .b-font:before,.pull-right-h-font:hover .b-font:before,.pull-right-ha-font .b-font:before,.pull-right-ha-font.hover .b-font:before,.pull-right-ha-font:focus .b-font:before,.pull-right-ha-font:hover .b-font:before{content:"\e607";color:inherit}.pull-right-ha-font.active .b-font:before,.pull-right-ha-font:active .b-font:before{content:"\e607";color:#3f8ce8}.pull-right-e-font .b-font:before,.pull-right-e-font.hover .b-font:before,.pull-right-e-font:focus .b-font:before,.pull-right-e-font:hover .b-font:before,.pull-right-ha-font.disabled .b-font:before,.pull-right-ha-font.native .b-font:before{content:"\e607";color:inherit}.pull-right-e-font.active .b-font:before,.pull-right-e-font:active .b-font:before{content:"\e607";color:#3f8ce8}.pull-right-e-font.disabled .b-font:before,.pull-right-e-font.native .b-font:before{content:"\e607";color:inherit}.copy-font .b-font:before,.copy-font.disabled .b-font:before,.copy-font.native .b-font:before{content:"\e610";color:inherit}.copy-h-font .b-font:before{content:"\e610";color:#1a1a1a}.copy-h-font.hover .b-font:before,.copy-h-font:focus .b-font:before,.copy-h-font:hover .b-font:before{content:"\e610";color:inherit}.copy-h-font.disabled .b-font:before,.copy-h-font.native .b-font:before{content:"\e610";color:#1a1a1a}.copy-ha-font .b-font:before,.copy-ha-font.hover .b-font:before,.copy-ha-font:focus .b-font:before,.copy-ha-font:hover .b-font:before{content:"\e610";color:inherit}.copy-ha-font.active .b-font:before,.copy-ha-font:active .b-font:before{content:"\e610";color:#3f8ce8}.copy-e-font .b-font:before,.copy-e-font.hover .b-font:before,.copy-e-font:focus .b-font:before,.copy-e-font:hover .b-font:before,.copy-ha-font.disabled .b-font:before,.copy-ha-font.native .b-font:before{content:"\e610";color:inherit}.copy-e-font.active .b-font:before,.copy-e-font:active .b-font:before{content:"\e610";color:#3f8ce8}.copy-e-font.disabled .b-font:before,.copy-e-font.native .b-font:before{content:"\e610";color:inherit}.check-mark-font .b-font:before,.check-mark-font.disabled .b-font:before,.check-mark-font.native .b-font:before,.check-mark-h-font .b-font:before,.check-mark-h-font.disabled .b-font:before,.check-mark-h-font.hover .b-font:before,.check-mark-h-font.native .b-font:before,.check-mark-h-font:focus .b-font:before,.check-mark-h-font:hover .b-font:before,.check-mark-ha-font .b-font:before,.check-mark-ha-font.hover .b-font:before,.check-mark-ha-font:focus .b-font:before,.check-mark-ha-font:hover .b-font:before{content:"\e611";color:inherit}.check-mark-ha-font.active .b-font:before,.check-mark-ha-font:active .b-font:before{content:"\e611";color:#3f8ce8}.check-mark-e-font .b-font:before,.check-mark-e-font.hover .b-font:before,.check-mark-e-font:focus .b-font:before,.check-mark-e-font:hover .b-font:before,.check-mark-ha-font.disabled .b-font:before,.check-mark-ha-font.native .b-font:before{content:"\e611";color:inherit}.check-mark-e-font.active .b-font:before,.check-mark-e-font:active .b-font:before{content:"\e611";color:#3f8ce8}.check-mark-e-font.disabled .b-font:before,.check-mark-e-font.native .b-font:before{content:"\e611";color:inherit}.tree-node-triangle-expand-font .b-font:before,.tree-node-triangle-expand-font.disabled .b-font:before,.tree-node-triangle-expand-font.native .b-font:before{content:"\e608";color:inherit}.tree-node-triangle-collapse-font .b-font:before,.tree-node-triangle-collapse-font.disabled .b-font:before,.tree-node-triangle-collapse-font.native .b-font:before{content:"\e607";color:inherit}.row-pre-page-h-font .b-font:before,.row-pre-page-h-font.disabled .b-font:before,.row-pre-page-h-font.hover .b-font:before,.row-pre-page-h-font.native .b-font:before,.row-pre-page-h-font:focus .b-font:before,.row-pre-page-h-font:hover .b-font:before{content:"\e6be";color:inherit}.row-next-page-h-font .b-font:before,.row-next-page-h-font.disabled .b-font:before,.row-next-page-h-font.hover .b-font:before,.row-next-page-h-font.native .b-font:before,.row-next-page-h-font:focus .b-font:before,.row-next-page-h-font:hover .b-font:before{content:"\e6bd";color:inherit}.column-pre-page-h-font .b-font:before,.column-pre-page-h-font.disabled .b-font:before,.column-pre-page-h-font.hover .b-font:before,.column-pre-page-h-font.native .b-font:before,.column-pre-page-h-font:focus .b-font:before,.column-pre-page-h-font:hover .b-font:before{content:"\e6bc";color:inherit}.column-next-page-h-font .b-font:before,.column-next-page-h-font.disabled .b-font:before,.column-next-page-h-font.hover .b-font:before,.column-next-page-h-font.native .b-font:before,.column-next-page-h-font:focus .b-font:before,.column-next-page-h-font:hover .b-font:before{content:"\e6bb";color:inherit}.trigger-triangle-font .b-font:before,.trigger-triangle-font.hover .b-font:before,.trigger-triangle-font:focus .b-font:before,.trigger-triangle-font:hover .b-font:before{content:"\e66a";color:#999}.trigger-triangle-font.active .b-font:before,.trigger-triangle-font:active .b-font:before{content:"\e66a";color:#3f8ce8}.trigger-triangle-font.disabled .b-font:before,.trigger-triangle-font.native .b-font:before{content:"\e66a";color:#999}.pull-down-font .b-font:before,.pull-down-font.disabled .b-font:before,.pull-down-font.native .b-font:before,.pull-down-h-font .b-font:before,.pull-down-h-font.disabled .b-font:before,.pull-down-h-font.hover .b-font:before,.pull-down-h-font.native .b-font:before,.pull-down-h-font:focus .b-font:before,.pull-down-h-font:hover .b-font:before,.pull-down-ha-font .b-font:before,.pull-down-ha-font.hover .b-font:before,.pull-down-ha-font:focus .b-font:before,.pull-down-ha-font:hover .b-font:before{content:"\e608";color:inherit}.pull-down-ha-font.active .b-font:before,.pull-down-ha-font:active .b-font:before{content:"\e608";color:#3f8ce8}.pull-down-ha-font.disabled .b-font:before,.pull-down-ha-font.native .b-font:before{content:"\e608";color:inherit}.check-font .b-font:before,.check-font.disabled .b-font:before,.check-font.native .b-font:before{content:"\e611";color:#3f8ce8}.item-check-font .b-font:before{content:"\e611";color:#fff}.item-check-font.hover .b-font:before,.item-check-font:focus .b-font:before,.item-check-font:hover .b-font:before{content:"\e611";color:#999}.item-check-font.active .b-font:before,.item-check-font:active .b-font:before{content:"\e611";color:#3f8ce8}.item-check-font.disabled .b-font:before,.item-check-font.native .b-font:before{content:"\e611";color:#fff}.primary-key-font .b-font:before,.primary-key-font.disabled .b-font:before,.primary-key-font.hover .b-font:before,.primary-key-font.native .b-font:before,.primary-key-font:focus .b-font:before,.primary-key-font:hover .b-font:before{content:"\e67d;";color:inherit}.drag-tag-font .b-font:before,.drag-tag-font.disabled .b-font:before,.drag-tag-font.native .b-font:before{content:"\e600";color:#f07d0a}.less-font .b-font:before,.less-font.hover .b-font:before,.less-font:focus .b-font:before,.less-font:hover .b-font:before{content:"\e633";color:inherit}.less-font.active .b-font:before,.less-font:active .b-font:before{content:"\e633";color:#3f8ce8}.less-font.disabled .b-font:before,.less-font.native .b-font:before{content:"\e633";color:inherit}.less-equal-font .b-font:before,.less-equal-font.hover .b-font:before,.less-equal-font:focus .b-font:before,.less-equal-font:hover .b-font:before{content:"\e636";color:inherit}.less-equal-font.active .b-font:before,.less-equal-font:active .b-font:before{content:"\e636";color:#3f8ce8}.less-equal-font.disabled .b-font:before,.less-equal-font.native .b-font:before{content:"\e636";color:inherit}.text-bold-font .b-font:before,.text-bold-font.disabled .b-font:before,.text-bold-font.native .b-font:before{content:"\e64d";color:inherit}.text-italic-font .b-font:before,.text-italic-font.disabled .b-font:before,.text-italic-font.native .b-font:before{content:"\e656";color:inherit}.text-underline-font .b-font:before,.text-underline-font.disabled .b-font:before,.text-underline-font.native .b-font:before{content:"\e650";color:inherit}.text-color-font .b-font:before,.text-color-font.disabled .b-font:before,.text-color-font.native .b-font:before{content:"\e69c";color:inherit}.text-background-font .b-font:before,.text-background-font.disabled .b-font:before,.text-background-font.native .b-font:before{content:"\e696";color:inherit}.text-color-underline-font .b-font:before,.text-color-underline-font.disabled .b-font:before,.text-color-underline-font.native .b-font:before{content:"\e69d";color:inherit}.text-align-left-font .b-font:before,.text-align-left-font.disabled .b-font:before,.text-align-left-font.native .b-font:before{content:"\e654";color:inherit}.text-align-center-font .b-font:before,.text-align-center-font.disabled .b-font:before,.text-align-center-font.native .b-font:before{content:"\e64f";color:inherit}.text-align-right-font .b-font:before,.text-align-right-font.disabled .b-font:before,.text-align-right-font.native .b-font:before{content:"\e651";color:inherit}.tree-collapse-icon-type1 .x-icon,.tree-collapse-icon-type1:active .x-icon,.tree-collapse-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-1.png) no-repeat;background-size:contain}.tree-collapse-icon-type1 .x-icon.hack,.tree-collapse-icon-type1:active .x-icon.hack,.tree-collapse-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-1.png) no-repeat}.tree-collapse-icon-type1.disabled .x-icon,.tree-collapse-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-1.png) no-repeat;background-size:contain}.tree-collapse-icon-type1.disabled .x-icon.hack,.tree-collapse-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-1.png) no-repeat}.tree-collapse-icon-type2 .x-icon,.tree-collapse-icon-type2:active .x-icon,.tree-collapse-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-2.png) no-repeat;background-size:contain}.tree-collapse-icon-type2 .x-icon.hack,.tree-collapse-icon-type2:active .x-icon.hack,.tree-collapse-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-2.png) no-repeat}.tree-collapse-icon-type2.disabled .x-icon,.tree-collapse-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-2.png) no-repeat;background-size:contain}.tree-collapse-icon-type2.disabled .x-icon.hack,.tree-collapse-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-2.png) no-repeat}.tree-collapse-icon-type3 .x-icon,.tree-collapse-icon-type3:active .x-icon,.tree-collapse-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-3.png) no-repeat;background-size:contain}.tree-collapse-icon-type3 .x-icon.hack,.tree-collapse-icon-type3:active .x-icon.hack,.tree-collapse-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-3.png) no-repeat}.tree-collapse-icon-type3.disabled .x-icon,.tree-collapse-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-3.png) no-repeat;background-size:contain}.tree-collapse-icon-type3.disabled .x-icon.hack,.tree-collapse-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-3.png) no-repeat}.tree-collapse-icon-type4 .x-icon,.tree-collapse-icon-type4:active .x-icon,.tree-collapse-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-4.png) no-repeat;background-size:contain}.tree-collapse-icon-type4 .x-icon.hack,.tree-collapse-icon-type4:active .x-icon.hack,.tree-collapse-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-4.png) no-repeat}.tree-collapse-icon-type4.disabled .x-icon,.tree-collapse-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-collapse-4.png) no-repeat;background-size:contain}.tree-collapse-icon-type4.disabled .x-icon.hack,.tree-collapse-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-collapse-4.png) no-repeat}.tree-expand-icon-type1 .x-icon,.tree-expand-icon-type1:active .x-icon,.tree-expand-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-1.png) no-repeat;background-size:contain}.tree-expand-icon-type1 .x-icon.hack,.tree-expand-icon-type1:active .x-icon.hack,.tree-expand-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-1.png) no-repeat}.tree-expand-icon-type1.disabled .x-icon,.tree-expand-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-1.png) no-repeat;background-size:contain}.tree-expand-icon-type1.disabled .x-icon.hack,.tree-expand-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-1.png) no-repeat}.tree-expand-icon-type2 .x-icon,.tree-expand-icon-type2:active .x-icon,.tree-expand-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-2.png) no-repeat;background-size:contain}.tree-expand-icon-type2 .x-icon.hack,.tree-expand-icon-type2:active .x-icon.hack,.tree-expand-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-2.png) no-repeat}.tree-expand-icon-type2.disabled .x-icon,.tree-expand-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-2.png) no-repeat;background-size:contain}.tree-expand-icon-type2.disabled .x-icon.hack,.tree-expand-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-2.png) no-repeat}.tree-expand-icon-type3 .x-icon,.tree-expand-icon-type3:active .x-icon,.tree-expand-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-3.png) no-repeat;background-size:contain}.tree-expand-icon-type3 .x-icon.hack,.tree-expand-icon-type3:active .x-icon.hack,.tree-expand-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-3.png) no-repeat}.tree-expand-icon-type3.disabled .x-icon,.tree-expand-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-3.png) no-repeat;background-size:contain}.tree-expand-icon-type3.disabled .x-icon.hack,.tree-expand-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-3.png) no-repeat}.tree-expand-icon-type4 .x-icon,.tree-expand-icon-type4:active .x-icon,.tree-expand-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-4.png) no-repeat;background-size:contain}.tree-expand-icon-type4 .x-icon.hack,.tree-expand-icon-type4:active .x-icon.hack,.tree-expand-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-4.png) no-repeat}.tree-expand-icon-type4.disabled .x-icon,.tree-expand-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-expand-4.png) no-repeat;background-size:contain}.tree-expand-icon-type4.disabled .x-icon.hack,.tree-expand-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-expand-4.png) no-repeat}.tree-vertical-line-type2 .x-icon,.tree-vertical-line-type2:active .x-icon,.tree-vertical-line-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-2.png) no-repeat;background-size:contain}.tree-vertical-line-type2 .x-icon.hack,.tree-vertical-line-type2:active .x-icon.hack,.tree-vertical-line-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-2.png) no-repeat}.tree-vertical-line-type2.disabled .x-icon,.tree-vertical-line-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-2.png) no-repeat;background-size:contain}.tree-vertical-line-type2.disabled .x-icon.hack,.tree-vertical-line-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-2.png) no-repeat}.tree-vertical-line-type3 .x-icon,.tree-vertical-line-type3:active .x-icon,.tree-vertical-line-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-3.png) no-repeat;background-size:contain}.tree-vertical-line-type3 .x-icon.hack,.tree-vertical-line-type3:active .x-icon.hack,.tree-vertical-line-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-3.png) no-repeat}.tree-vertical-line-type3.disabled .x-icon,.tree-vertical-line-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-3.png) no-repeat;background-size:contain}.tree-vertical-line-type3.disabled .x-icon.hack,.tree-vertical-line-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-3.png) no-repeat}.tree-vertical-line-type4 .x-icon,.tree-vertical-line-type4:active .x-icon,.tree-vertical-line-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-4.png) no-repeat;background-size:contain}.tree-vertical-line-type4 .x-icon.hack,.tree-vertical-line-type4:active .x-icon.hack,.tree-vertical-line-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-4.png) no-repeat}.tree-vertical-line-type4.disabled .x-icon,.tree-vertical-line-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/tree-vertical-line-4.png) no-repeat;background-size:contain}.tree-vertical-line-type4.disabled .x-icon.hack,.tree-vertical-line-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/tree-vertical-line-4.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type1 .x-icon,.bi-theme-dark .tree-collapse-icon-type1:active .x-icon,.bi-theme-dark .tree-collapse-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type1 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type1:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-1.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type1.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type1.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-1.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type2 .x-icon,.bi-theme-dark .tree-collapse-icon-type2:active .x-icon,.bi-theme-dark .tree-collapse-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type2 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type2:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-2.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type2.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type2.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-2.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type3 .x-icon,.bi-theme-dark .tree-collapse-icon-type3:active .x-icon,.bi-theme-dark .tree-collapse-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type3 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type3:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-3.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type3.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type3.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-3.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type4 .x-icon,.bi-theme-dark .tree-collapse-icon-type4:active .x-icon,.bi-theme-dark .tree-collapse-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type4 .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type4:active .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-4.png) no-repeat}.bi-theme-dark .tree-collapse-icon-type4.disabled .x-icon,.bi-theme-dark .tree-collapse-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-collapse-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-collapse-icon-type4.disabled .x-icon.hack,.bi-theme-dark .tree-collapse-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-collapse-4.png) no-repeat}.bi-theme-dark .tree-expand-icon-type1 .x-icon,.bi-theme-dark .tree-expand-icon-type1:active .x-icon,.bi-theme-dark .tree-expand-icon-type1:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type1 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type1:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type1:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-1.png) no-repeat}.bi-theme-dark .tree-expand-icon-type1.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type1.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-1.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type1.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type1.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-1.png) no-repeat}.bi-theme-dark .tree-expand-icon-type2 .x-icon,.bi-theme-dark .tree-expand-icon-type2:active .x-icon,.bi-theme-dark .tree-expand-icon-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type2 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type2:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-2.png) no-repeat}.bi-theme-dark .tree-expand-icon-type2.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type2.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-2.png) no-repeat}.bi-theme-dark .tree-expand-icon-type3 .x-icon,.bi-theme-dark .tree-expand-icon-type3:active .x-icon,.bi-theme-dark .tree-expand-icon-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type3 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type3:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-3.png) no-repeat}.bi-theme-dark .tree-expand-icon-type3.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type3.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-3.png) no-repeat}.bi-theme-dark .tree-expand-icon-type4 .x-icon,.bi-theme-dark .tree-expand-icon-type4:active .x-icon,.bi-theme-dark .tree-expand-icon-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type4 .x-icon.hack,.bi-theme-dark .tree-expand-icon-type4:active .x-icon.hack,.bi-theme-dark .tree-expand-icon-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-4.png) no-repeat}.bi-theme-dark .tree-expand-icon-type4.disabled .x-icon,.bi-theme-dark .tree-expand-icon-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-expand-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-expand-icon-type4.disabled .x-icon.hack,.bi-theme-dark .tree-expand-icon-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-expand-4.png) no-repeat}.bi-theme-dark .tree-vertical-line-type2 .x-icon,.bi-theme-dark .tree-vertical-line-type2:active .x-icon,.bi-theme-dark .tree-vertical-line-type2:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type2 .x-icon.hack,.bi-theme-dark .tree-vertical-line-type2:active .x-icon.hack,.bi-theme-dark .tree-vertical-line-type2:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-2.png) no-repeat}.bi-theme-dark .tree-vertical-line-type2.disabled .x-icon,.bi-theme-dark .tree-vertical-line-type2.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-2.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type2.disabled .x-icon.hack,.bi-theme-dark .tree-vertical-line-type2.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-2.png) no-repeat}.bi-theme-dark .tree-vertical-line-type3 .x-icon,.bi-theme-dark .tree-vertical-line-type3:active .x-icon,.bi-theme-dark .tree-vertical-line-type3:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type3 .x-icon.hack,.bi-theme-dark .tree-vertical-line-type3:active .x-icon.hack,.bi-theme-dark .tree-vertical-line-type3:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-3.png) no-repeat}.bi-theme-dark .tree-vertical-line-type3.disabled .x-icon,.bi-theme-dark .tree-vertical-line-type3.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-3.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type3.disabled .x-icon.hack,.bi-theme-dark .tree-vertical-line-type3.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-3.png) no-repeat}.bi-theme-dark .tree-vertical-line-type4 .x-icon,.bi-theme-dark .tree-vertical-line-type4:active .x-icon,.bi-theme-dark .tree-vertical-line-type4:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type4 .x-icon.hack,.bi-theme-dark .tree-vertical-line-type4:active .x-icon.hack,.bi-theme-dark .tree-vertical-line-type4:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-4.png) no-repeat}.bi-theme-dark .tree-vertical-line-type4.disabled .x-icon,.bi-theme-dark .tree-vertical-line-type4.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/dark/tree-vertical-line-4.png) no-repeat;background-size:contain}.bi-theme-dark .tree-vertical-line-type4.disabled .x-icon.hack,.bi-theme-dark .tree-vertical-line-type4.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/dark/tree-vertical-line-4.png) no-repeat}.check-box-icon .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-normal.png) no-repeat;background-size:contain}.check-box-icon .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-normal.png) no-repeat}.check-box-icon.hover .x-icon,.check-box-icon:focus .x-icon,.check-box-icon:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-normal.png) no-repeat;background-size:contain}.check-box-icon.hover .x-icon.hack,.check-box-icon:focus .x-icon.hack,.check-box-icon:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-normal.png) no-repeat}.check-box-icon.active .x-icon,.check-box-icon:active .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-active.png) no-repeat;background-size:contain}.check-box-icon.active .x-icon.hack,.check-box-icon:active .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-active.png) no-repeat}.check-box-icon.disabled .x-icon,.check-box-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-disable.png) no-repeat;background-size:contain}.check-box-icon.disabled .x-icon.hack,.check-box-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-disable.png) no-repeat}.check-box-icon.disabled.active .x-icon,.check-box-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/check-box-disable2.png) no-repeat;background-size:contain}.check-box-icon.disabled.active .x-icon.hack,.check-box-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/check-box-disable2.png) no-repeat}.radio-icon .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-normal.png) no-repeat;background-size:contain}.radio-icon .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-normal.png) no-repeat}.radio-icon.hover .x-icon,.radio-icon:focus .x-icon,.radio-icon:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-normal.png) no-repeat;background-size:contain}.radio-icon.hover .x-icon.hack,.radio-icon:focus .x-icon.hack,.radio-icon:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-normal.png) no-repeat}.radio-icon.active .x-icon,.radio-icon:active .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-active.png) no-repeat;background-size:contain}.radio-icon.active .x-icon.hack,.radio-icon:active .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-active.png) no-repeat}.radio-icon.disabled .x-icon,.radio-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-disable.png) no-repeat;background-size:contain}.radio-icon.disabled .x-icon.hack,.radio-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-disable.png) no-repeat}.radio-icon.disabled.active .x-icon,.radio-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/radio-disable2.png) no-repeat;background-size:contain}.radio-icon.disabled.active .x-icon.hack,.radio-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/radio-disable2.png) no-repeat}.check-half-select-icon .x-icon,.check-half-select-icon:active .x-icon,.check-half-select-icon:hover .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/half_selected.png) no-repeat;background-size:contain}.check-half-select-icon .x-icon.hack,.check-half-select-icon:active .x-icon.hack,.check-half-select-icon:hover .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/half_selected.png) no-repeat}.check-half-select-icon.disabled .x-icon,.check-half-select-icon.native .x-icon{display:block;background:url(https://fanruan.coding.me/fineui/dist/images/2x/icon/half_selected.png) no-repeat;background-size:contain}.check-half-select-icon.disabled .x-icon.hack,.check-half-select-icon.native .x-icon.hack{background:url(https://fanruan.coding.me/fineui/dist/images/1x/icon/half_selected.png) no-repeat} \ No newline at end of file diff --git a/dist/bundle.min.js b/dist/bundle.min.js index 0b1b9cd1f..843f271ec 100644 --- a/dist/bundle.min.js +++ b/dist/bundle.min.js @@ -25,10 +25,10 @@ hs:1,rg:1},fa=/,?([achlmqrstvxz]),?/gi,ga=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\ },ab=function(a,c){return function(d,e,f){d=Ia(d);for(var g,h,i,j,k,l="",m={},n=0,o=0,p=d.length;o
e){if(c&&!m.start){if(k=_a(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),l+=["C"+k.start.x,k.start.y,k.m.x,k.m.y,k.x,k.y],f)return l;m.start=l,l=["M"+k.x,k.y+"C"+k.n.x,k.n.y,k.end.x,k.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!a&&!c)return k=_a(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),{x:k.x,y:k.y,alpha:k.alpha}}n+=j,g=+i[5],h=+i[6]}l+=i.shift()+i}return m.end=l,k=a?n:c?m:b.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),k.alpha&&(k={x:k.x,y:k.y,alpha:k.alpha}),k}},bb=ab(1),cb=ab(),db=ab(0,1);b.getTotalLength=bb,b.getPointAtLength=cb,b.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return db(a,b).end;var d=db(a,c,1);return b?db(d,b).end:d},Xa.getTotalLength=function(){var a=this.getPath();if(a)return this.node.getTotalLength?this.node.getTotalLength():bb(a)},Xa.getPointAtLength=function(a){var b=this.getPath();if(b)return cb(b,a)},Xa.getPath=function(){var a,c=b._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return c&&(a=c(this)),a},Xa.getSubpath=function(a,c){var d=this.getPath();if(d)return b.getSubpath(d,a,c)};var eb=b.easing_formulas={linear:function(a){return a},"<":function(a){return Q(a,1.7)},">":function(a){return Q(a,.48)},"<>":function(a){var b=.48-a/1.04,c=M.sqrt(.1734+b*b),d=c-b,e=Q(P(d),1/3)*(d<0?-1:1),f=-c-b,g=Q(P(f),1/3)*(f<0?-1:1),h=e+g+.5;return 3*(1-h)*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){return a==!!a?a:Q(2,-10*a)*M.sin((a-.075)*(2*R)/.3)+1},bounce:function(a){var b,c=7.5625,d=2.75;return a<1/d?b=c*a*a:a<2/d?(a-=1.5/d,b=c*a*a+.75):a<2.5/d?(a-=2.25/d,b=c*a*a+.9375):(a-=2.625/d,b=c*a*a+.984375),b}};eb.easeIn=eb["ease-in"]=eb["<"],eb.easeOut=eb["ease-out"]=eb[">"],eb.easeInOut=eb["ease-in-out"]=eb["<>"],eb["back-in"]=eb.backIn,eb["back-out"]=eb.backOut;var fb=[],gb=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},hb=function(){for(var c=+new Date,d=0;d')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e=b.width,f=b.x,g=b.y;if(!c)throw new Error("VML container not found.");var h=new a._Paper,i=h.canvas=a._g.doc.createElement("div"),j=i.style;return f=f||0,g=g||0,e=e||512,d=d||342,h.width=e,h.height=d,e==+e&&(e+="px"),d==+d&&(d+="px"),h.coordsize=1e3*u+n+1e3*u,h.coordorigin="0 0",h.span=a._g.doc.createElement("span"),h.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",i.appendChild(h.span),j.cssText=a.format("top:0;left:0;display:inline-block;position:absolute;clip:rect(0 {0} {1} 0);",e,d),1==c?(a._g.doc.body.appendChild(i),j.left=f+"px",j.top=g+"px",j.position="absolute"):c.firstChild?c.insertBefore(i,c.firstChild):c.appendChild(i),h.renderfix=function(){},h},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]="function"==typeof this[b]?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}}),function(a,b){if("function"==typeof define&&define.amd)define("raphael",["raphael.core","raphael.svg","raphael.vml"],function(a){return b(a)});else if("object"==typeof exports){var c=require("raphael.core");require("raphael.svg"),require("raphael.vml"),module.exports=b(c)}}(this,function(a){return a.ninja()}),BI.Svg=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Svg.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-svg"})},_init:function(){BI.Svg.superclass._init.apply(this,arguments),this.paper=Raphael(this.element[0]),this.element.css("overflow","hidden"),$(this.paper.canvas).width("100%").height("100%").css({left:"0",top:"0"}).appendTo(this.element),this.top=this.paper.top,this.bottom=this.paper.bottom,this.customAttributes=this.paper.customAttributes,this.ca=this.paper.ca,this.raphael=this.paper.raphael},add:function(){return this.paper.add.apply(this.paper,arguments)},path:function(){return this.paper.path.apply(this.paper,arguments)},image:function(){return this.paper.image.apply(this.paper,arguments)},rect:function(){return this.paper.rect.apply(this.paper,arguments)},circle:function(){return this.paper.circle.apply(this.paper,arguments)},ellipse:function(){return this.paper.ellipse.apply(this.paper,arguments)},text:function(){return this.paper.text.apply(this.paper,arguments)},print:function(){return this.paper.print.apply(this.paper,arguments)},setStart:function(){return this.paper.setStart.apply(this.paper,arguments)},setFinish:function(){return this.paper.setFinish.apply(this.paper,arguments)},setSize:function(){return this.paper.setSize.apply(this.paper,arguments)},setViewBox:function(){return this.paper.setViewBox.apply(this.paper,arguments)},getById:function(){return this.paper.getById.apply(this.paper,arguments)},getElementByPoint:function(){return this.paper.getElementByPoint.apply(this.paper,arguments)},getElementsByPoint:function(){return this.paper.getElementsByPoint.apply(this.paper,arguments)},getFont:function(){return this.paper.getFont.apply(this.paper,arguments)},set:function(){return this.paper.set.apply(this.paper,arguments)},remove:function(){return this.paper.remove.apply(this.paper,arguments)},clear:function(){return this.paper.clear.apply(this.paper,arguments)}}),BI.shortcut("bi.svg",BI.Svg),BI.NativeTableScrollbar=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this,arguments),{attributes:{tabIndex:0},contentSize:0,defaultPosition:0,position:0,size:0})},render:function(){var a=this;this.options;this.element.width(36);var b=BI.throttle(function(){a.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL,a.element.scrollTop())},150,{leading:!1});return this.element.scroll(function(){b()}),{type:"bi.default",scrolly:!0,items:[{type:"bi.layout",width:1,ref:function(b){a.inner=b}}]}},mounted:function(){this._populate()},_populate:function(){var a=this.options;if(a.size<1||a.contentSize<=a.size)return void this.setVisible(!1);this.setVisible(!0);try{this.element.scrollTop(a.position)}catch(b){}this.inner.element.height(a.contentSize)},setContentSize:function(a){this.options.contentSize=a},setPosition:function(a){this.options.position=a},setSize:function(a){this.setHeight(a),this.options.size=a},populate:function(){this._populate()}}),BI.NativeTableScrollbar.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.native_table_scrollbar",BI.NativeTableScrollbar),BI.NativeTableHorizontalScrollbar=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this,arguments),{attributes:{tabIndex:0},contentSize:0,position:0,size:0})},render:function(){var a=this;this.options;this.element.height(36);var b=BI.throttle(function(){a.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL,a.element.scrollLeft())},150,{leading:!1});return this.element.scroll(function(){b()}),{type:"bi.default",scrollx:!0,items:[{type:"bi.layout",height:1,ref:function(b){a.inner=b}}]}},setContentSize:function(a){this.options.contentSize=a},setPosition:function(a){this.options.position=a},setSize:function(a){this.setWidth(a),this.options.size=a},_populate:function(){var a=this.options;if(a.size<1||a.contentSize<=a.size)return void this.setVisible(!1);this.setVisible(!0);try{this.element.scrollLeft(a.position)}catch(b){}this.inner.element.width(a.contentSize)},populate:function(){this._populate()}}),BI.NativeTableHorizontalScrollbar.EVENT_SCROLL="EVENT_SCROLL",BI.shortcut("bi.native_table_horizontal_scrollbar",BI.NativeTableHorizontalScrollbar),BI.TableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-table-cell",textAlign:"left",text:""})},_init:function(){BI.TableCell.superclass._init.apply(this,arguments),BI.createWidget({type:"bi.label",element:this,whiteSpace:"nowrap",textAlign:this.options.textAlign,height:this.options.height,text:this.options.text,value:this.options.value,lgap:5})}}),BI.shortcut("bi.table_cell",BI.TableCell),BI.CollectionTableCell=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CollectionTableCell.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-collection-table-cell bi-border-right bi-border-bottom",width:0,height:0,_left:0,_top:0,cell:{}})},_init:function(){BI.CollectionTableCell.superclass._init.apply(this,arguments);var a=this.options;this.cell=BI.createWidget(BI.extend({type:"bi.label"},a.cell,{cls:(a.cell.cls||"")+" collection-table-cell-wrapper",width:a.width-(0===a._left?1:0)-1,height:a.height-(0===a._top?1:0)-1})),BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.cell,left:0,right:0,top:0,bottom:0}]})},setWidth:function(a){BI.CollectionTableCell.superclass.setWidth.apply(this,arguments);var b=this.options;this.cell.setWidth(b.width-(0===b._left?1:0)-1)},setHeight:function(a){BI.CollectionTableCell.superclass.setHeight.apply(this,arguments);var b=this.options;this.cell.setHeight(b.height-(0===b._top?1:0)-1)}}),BI.shortcut("bi.collection_table_cell",BI.CollectionTableCell),BI.CollectionTable=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.CollectionTable.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-collection-table",headerRowSize:25,rowSize:25,columnSize:[],isNeedFreeze:!1,freezeCols:[],isNeedMerge:!1,mergeCols:[],mergeRule:BI.emptyFn,header:[],items:[],regionColumnSize:[]})},render:function(){var a=this,b=this.options;this._width=0,this._height=0,this._scrollBarSize=BI.DOM.getScrollWidth(),this.topLeftCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.topLeftItems[b]}}),this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomLeftCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.topRightCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.topRightItems[b]}}),this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomRightCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.bottomLeftCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.bottomLeftItems[b]}}),this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomRightCollection.setScrollTop(b.scrollTop),a.topLeftCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.bottomRightCollection=BI.createWidget({type:"bi.collection_view",cellSizeAndPositionGetter:function(b){return a.bottomRightItems[b]}}),this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL,function(b){a.bottomLeftCollection.setScrollTop(b.scrollTop),a.topRightCollection.setScrollLeft(b.scrollLeft),a._populateScrollbar(),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.topLeft=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.topLeftCollection]}),this.topRight=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.topRightCollection]}),this.bottomLeft=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.bottomLeftCollection]}),this.bottomRight=BI.createWidget({type:"bi.vertical",scrollable:!1,scrolly:!1,items:[this.bottomRightCollection]}),this.contextLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.topLeft,top:0,left:0},{el:this.topRight,top:0},{el:this.bottomLeft,left:0},{el:this.bottomRight}]}),this.topScrollbar=BI.createWidget({type:"bi.grid_table_scrollbar",width:BI.GridTableScrollbar.SIZE}),this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.bottomLeftCollection.setScrollTop(b),a.bottomRightCollection.setScrollTop(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.leftScrollbar=BI.createWidget({type:"bi.grid_table_horizontal_scrollbar",height:BI.GridTableScrollbar.SIZE}),this.leftScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.topLeftCollection.setScrollLeft(b),a.bottomLeftCollection.setScrollLeft(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.rightScrollbar=BI.createWidget({type:"bi.grid_table_horizontal_scrollbar",height:BI.GridTableScrollbar.SIZE}),this.rightScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL,function(b){a.topRightCollection.setScrollLeft(b),a.bottomRightCollection.setScrollLeft(b),a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.scrollBarLayout=BI.createWidget({type:"bi.absolute",element:this,items:[{el:this.topScrollbar,right:0,top:0},{el:this.leftScrollbar,left:0},{el:this.rightScrollbar}]}),this._width=b.width-BI.GridTableScrollbar.SIZE,this._height=b.height-BI.GridTableScrollbar.SIZE},mounted:function(){var a=this.options;(a.items.length>0||a.header.length>0)&&(this._digest(),this._populate())},_getFreezeColLength:function(){return this.options.isNeedFreeze?this.options.freezeCols.length:0},_getFreezeHeaderHeight:function(){var a=this.options;return a.header.length*a.headerRowSize>=this._height?0:a.header.length*a.headerRowSize},_getActualItems:function(){var a=this.options;return a.header.length*a.headerRowSize>=this._height?a.header.concat(a.items):a.items},_populateScrollbar:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[];BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g}),this.topScrollbar.setContentSize(this._getActualItems().length*a.rowSize),this.topScrollbar.setSize(this._height-this._getFreezeHeaderHeight()),this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop()),this.topScrollbar.populate(),this.leftScrollbar.setContentSize(c),this.leftScrollbar.setSize(b),this.leftScrollbar.setPosition(this.bottomLeftCollection.getScrollLeft()),this.leftScrollbar.populate(),this.rightScrollbar.setContentSize(d),this.rightScrollbar.setSize(this._width-b),this.rightScrollbar.setPosition(this.bottomRightCollection.getScrollLeft()),this.rightScrollbar.populate();var g=this.scrollBarLayout.attr("items");g[0].top=this._getFreezeHeaderHeight(),g[1].top=this._height,g[2].top=this._height,g[2].left=b,this.scrollBarLayout.attr("items",g),this.scrollBarLayout.resize()},_populateTable:function(){var a=this.options,b=this.getRegionSize(),c=0,d=0,e=0,f=[];BI.each(a.columnSize,function(b,g){a.isNeedFreeze===!0&&a.freezeCols.contains(b)?c+=g:d+=g,e+=g,0===b?f[b]=g:f[b]=f[b-1]+g});var g=b,h=this._getFreezeHeaderHeight(),i=this._width-b,j=this._getFreezeHeaderHeight(),k=b,l=this._height-h,m=this._width-b,n=this._height-j,o=g+this._scrollBarSize,p=h+this._scrollBarSize,q=i+this._scrollBarSize,r=j+this._scrollBarSize,s=k+this._scrollBarSize,t=l+this._scrollBarSize,u=m+this._scrollBarSize,v=n+this._scrollBarSize,w=function(a){a.element.css({overflow:"scroll",overflowX:"scroll",overflowY:"scroll"})};this.topLeft.setWidth(g),this.topLeft.setHeight(h),this.topRight.setWidth(i),this.topRight.setHeight(j),this.bottomLeft.setWidth(k),this.bottomLeft.setHeight(l),this.bottomRight.setWidth(m),this.bottomRight.setHeight(n),this.topLeftCollection.setWidth(o),this.topLeftCollection.setHeight(p),this.topRightCollection.setWidth(q),this.topRightCollection.setHeight(r),this.bottomLeftCollection.setWidth(s),this.bottomLeftCollection.setHeight(t),this.bottomRightCollection.setWidth(u),this.bottomRightCollection.setHeight(v),w(this.topLeftCollection),w(this.topRightCollection),w(this.bottomLeftCollection),w(this.bottomRightCollection);var x=this.contextLayout.attr("items");x[1].left=b,x[2].top=this._getFreezeHeaderHeight(),x[3].left=b,x[3].top=this._getFreezeHeaderHeight(),this.contextLayout.attr("items",x),this.contextLayout.resize();var y=[],z=[],A=[],B=[],C=function(a,b,c){BI.each(a,function(a,d){var e={type:"bi.collection_table_cell",cell:b[d.row][d.col]};c.push(e)})};C(this.topLeftItems,a.header,y),C(this.topRightItems,a.header,z),C(this.bottomLeftItems,this._getActualItems(),A),C(this.bottomRightItems,this._getActualItems(),B),this.topLeftCollection._populate(y),this.topRightCollection._populate(z),this.bottomLeftCollection._populate(A),this.bottomRightCollection._populate(B)},_digest:function(){var a=this.options,b=this._getFreezeColLength();this._getFreezeHeaderHeight()<=0?(this.topLeftItems=[],this.topRightItems=[],this.bottomLeftItems=this._serialize(this._getActualItems(),0,b,a.rowSize,a.columnSize,a.mergeCols,BI.range(a.header.length)),this.bottomRightItems=this._serialize(this._getActualItems(),b,a.columnSize.length,a.rowSize,a.columnSize,a.mergeCols,BI.range(a.header.length))):(this.topLeftItems=this._serialize(a.header,0,b,a.headerRowSize,a.columnSize,a.mergeCols),this.topRightItems=this._serialize(a.header,b,a.columnSize.length,a.headerRowSize,a.columnSize,!0),this.bottomLeftItems=this._serialize(a.items,0,b,a.rowSize,a.columnSize,a.mergeCols),this.bottomRightItems=this._serialize(a.items,b,a.columnSize.length,a.rowSize,a.columnSize,a.mergeCols))},_serialize:function(a,b,c,d,e,f,g){f=f||[],g=g||[];for(var h=this.options,i=[],j={},k={},l={},m={},n=[],o=b;o
").attr("height",o).attr("width",i).css({width:i,height:o,position:"relative"}).addClass(0===(1&c)?"odd-col":"even-col").addClass(0===a?"first-row":"").addClass(0===c?"first-col":"").addClass(c===p.length-1?"last-col":""),r=BI.createWidget(n[a][c],{type:"bi.table_cell",textAlign:"left",width:BI.isNumeric(i)?i:"",height:BI.isNumeric(o)?o:"",_row:a,_col:c+f});h.addWidget(r.getName(),r),r._mount(),r.element.css("position","relative"),q.append(r.element),t.append(q),j[c]=q,j[c].__mergeRows=[a],m[c]=r,k[a]=q,k[a].__mergeCols=[c],l[a]=r,d[a][c]=q,e[a][c]=r}var t=$(" ").addClass(0===(1&a)?"odd":"even");BI.each(p,function(b,f){if(n[a]||(n[a]={}),d[a]||(d[a]={}),e[a]||(e[a]={}),n[a][b]=f,i.isNeedMerge&&c.contains(b))if(0===a&&0===b)s(0,0);else if(0===b&&a>0){var g=i.mergeRule(n[a][b],n[a-1][b]);g===!0?(q(a,b),k[a]=j[b],l[a]=m[b]):s(a,b)}else if(0===a&&b>0){var h=i.mergeRule(n[a][b],n[a][b-1]);h===!0?(r(a,b),j[b]=k[a],m[b]=l[a]):s(a,b)}else{var g=i.mergeRule(n[a][b],n[a-1][b]),h=i.mergeRule(n[a][b],n[a][b-1]);if(h&&g)return;h&&r(a,b),g&&q(a,b),h||g||s(a,b)}else s(a,b)}),o.appendChild(t[0])}),o},_createColGroupCells:function(a,b){var c=this,d=this.options;a=a||d.columnSize,b=b||{};var e=document.createDocumentFragment();return BI.each(a,function(a,d){var f=c._calculateWidth(d),g=$(" "),c.push(d),c.push("
")},makeUlLineClass:function(a,b){return a.view.showLine&&!b.isLastNode?consts.line.LINE:""},removeChildNodes:function(a,b){if(b){var c=a.data.key.children,d=b[c];if(d){for(var e=0,f=d.length;e").attr("height",o).attr("width",i).css({width:i,height:o,position:"relative"}).addClass(0===(1&c)?"odd-col":"even-col").addClass(0===a?"first-row":"").addClass(0===c?"first-col":"").addClass(c===p.length-1?"last-col":""),r=BI.createWidget(n[a][c],{type:"bi.table_cell",textAlign:"left",width:BI.isNumeric(i)?i:"",height:BI.isNumeric(o)?o:"",_row:a,_col:c+f});h.addWidget(r.getName(),r),r._mount(),r.element.css("position","relative"),q.append(r.element),t.append(q),j[c]=q,j[c].__mergeRows=[a],m[c]=r,k[a]=q,k[a].__mergeCols=[c],l[a]=r,d[a][c]=q,e[a][c]=r}var t=$(" ").addClass(0===(1&a)?"odd":"even");BI.each(p,function(b,f){if(n[a]||(n[a]={}),d[a]||(d[a]={}),e[a]||(e[a]={}),n[a][b]=f,i.isNeedMerge&&c.contains(b))if(0===a&&0===b)s(0,0);else if(0===b&&a>0){var g=i.mergeRule(n[a][b],n[a-1][b]);g===!0?(q(a,b),k[a]=j[b],l[a]=m[b]):s(a,b)}else if(0===a&&b>0){var h=i.mergeRule(n[a][b],n[a][b-1]);h===!0?(r(a,b),j[b]=k[a],m[b]=l[a]):s(a,b)}else{var g=i.mergeRule(n[a][b],n[a-1][b]),h=i.mergeRule(n[a][b],n[a][b-1]);if(h&&g)return;h&&r(a,b),g&&q(a,b),h||g||s(a,b)}else s(a,b)}),o.appendChild(t[0])}),o},_createColGroupCells:function(a,b){var c=this,d=this.options;a=a||d.columnSize,b=b||{};var e=document.createDocumentFragment();return BI.each(a,function(a,d){var f=c._calculateWidth(d),g=$(" "),c.push(d),c.push("
")},makeUlLineClass:function(a,b){return a.view.showLine&&!b.isLastNode?consts.line.LINE:""},removeChildNodes:function(a,b){if(b){var c=a.data.key.children,d=b[c];if(d){for(var e=0,f=d.length;e", that.document[ 0 ] ).appendTo( element )
- );
- } else if ( nodeName === "tr" ) {
- that._createTrPlaceholder( that.currentItem, element );
- } else if ( nodeName === "img" ) {
- element.attr( "src", that.currentItem.attr( "src" ) );
- }
-
- if ( !className ) {
- element.css( "visibility", "hidden" );
- }
-
- return element;
- },
- update: function(container, p) {
-
- // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
- // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
- if(className && !o.forcePlaceholderSize) {
- return;
- }
-
- //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
- if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
- if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
- }
- };
- }
-
- //Create the placeholder
- that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
-
- //Append it after the actual current item
- that.currentItem.after(that.placeholder);
-
- //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
- o.placeholder.update(that, that.placeholder);
-
- },
-
- _createTrPlaceholder: function( sourceTr, targetTr ) {
- var that = this;
-
- sourceTr.children().each(function() {
- $( " ", that.document[ 0 ] )
- .attr( "colspan", $( this ).attr( "colspan" ) || 1 )
- .appendTo( targetTr );
- });
- },
-
- _contactContainers: function(event) {
- var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
- innermostContainer = null,
- innermostIndex = null;
-
- // get innermost container that intersects with item
- for (i = this.containers.length - 1; i >= 0; i--) {
-
- // never consider a container that's located within the item itself
- if($.contains(this.currentItem[0], this.containers[i].element[0])) {
- continue;
- }
-
- if(this._intersectsWith(this.containers[i].containerCache)) {
-
- // if we've already found a container and it's more "inner" than this, then continue
- if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
- continue;
- }
-
- innermostContainer = this.containers[i];
- innermostIndex = i;
-
- } else {
- // container doesn't intersect. trigger "out" event if necessary
- if(this.containers[i].containerCache.over) {
- this.containers[i]._trigger("out", event, this._uiHash(this));
- this.containers[i].containerCache.over = 0;
- }
- }
-
- }
-
- // if no intersecting containers found, return
- if(!innermostContainer) {
- return;
- }
-
- // move the item into the container if it's not there already
- if(this.containers.length === 1) {
- if (!this.containers[innermostIndex].containerCache.over) {
- this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
- this.containers[innermostIndex].containerCache.over = 1;
- }
- } else {
-
- //When entering a new container, we will find the item with the least distance and append our item near it
- dist = 10000;
- itemWithLeastDistance = null;
- floating = innermostContainer.floating || this._isFloating(this.currentItem);
- posProperty = floating ? "left" : "top";
- sizeProperty = floating ? "width" : "height";
- axis = floating ? "clientX" : "clientY";
-
- for (j = this.items.length - 1; j >= 0; j--) {
- if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
- continue;
- }
- if(this.items[j].item[0] === this.currentItem[0]) {
- continue;
- }
-
- cur = this.items[j].item.offset()[posProperty];
- nearBottom = false;
- if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
- nearBottom = true;
- }
-
- if ( Math.abs( event[ axis ] - cur ) < dist ) {
- dist = Math.abs( event[ axis ] - cur );
- itemWithLeastDistance = this.items[ j ];
- this.direction = nearBottom ? "up": "down";
- }
- }
-
- //Check if dropOnEmpty is enabled
- if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
- return;
- }
-
- if(this.currentContainer === this.containers[innermostIndex]) {
- if ( !this.currentContainer.containerCache.over ) {
- this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
- this.currentContainer.containerCache.over = 1;
- }
- return;
- }
-
- itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
- this._trigger("change", event, this._uiHash());
- this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
- this.currentContainer = this.containers[innermostIndex];
-
- //Update the placeholder
- this.options.placeholder.update(this.currentContainer, this.placeholder);
-
- this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
- this.containers[innermostIndex].containerCache.over = 1;
- }
-
-
- },
-
- _createHelper: function(event) {
-
- var o = this.options,
- helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
-
- //Add the helper to the DOM if that didn't happen already
- if(!helper.parents("body").length) {
- $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
- }
-
- if(helper[0] === this.currentItem[0]) {
- this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
- }
-
- if(!helper[0].style.width || o.forceHelperSize) {
- helper.width(this.currentItem.width());
- }
- if(!helper[0].style.height || o.forceHelperSize) {
- helper.height(this.currentItem.height());
- }
-
- return helper;
-
- },
-
- _adjustOffsetFromHelper: function(obj) {
- if (typeof obj === "string") {
- obj = obj.split(" ");
- }
- if ($.isArray(obj)) {
- obj = {left: +obj[0], top: +obj[1] || 0};
- }
- if ("left" in obj) {
- this.offset.click.left = obj.left + this.margins.left;
- }
- if ("right" in obj) {
- this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
- }
- if ("top" in obj) {
- this.offset.click.top = obj.top + this.margins.top;
- }
- if ("bottom" in obj) {
- this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
- }
- },
-
- _getParentOffset: function() {
-
-
- //Get the offsetParent and cache its position
- this.offsetParent = this.helper.offsetParent();
- var po = this.offsetParent.offset();
-
- // This is a special case where we need to modify a offset calculated on start, since the following happened:
- // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
- // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
- // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
- if(this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {
- po.left += this.scrollParent.scrollLeft();
- po.top += this.scrollParent.scrollTop();
- }
-
- // This needs to be actually done for all browsers, since pageX/pageY includes this information
- // with an ugly IE fix
- if( this.offsetParent[0] === this.document[0].body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
- po = { top: 0, left: 0 };
- }
-
- return {
- top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
- left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
- };
-
- },
-
- _getRelativeOffset: function() {
-
- if(this.cssPosition === "relative") {
- var p = this.currentItem.position();
- return {
- top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
- left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
- };
- } else {
- return { top: 0, left: 0 };
- }
-
- },
-
- _cacheMargins: function() {
- this.margins = {
- left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
- top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
- };
- },
-
- _cacheHelperProportions: function() {
- this.helperProportions = {
- width: this.helper.outerWidth(),
- height: this.helper.outerHeight()
- };
- },
-
- _setContainment: function() {
-
- var ce, co, over,
- o = this.options;
- if(o.containment === "parent") {
- o.containment = this.helper[0].parentNode;
- }
- if(o.containment === "document" || o.containment === "window") {
- this.containment = [
- 0 - this.offset.relative.left - this.offset.parent.left,
- 0 - this.offset.relative.top - this.offset.parent.top,
- o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left,
- (o.containment === "document" ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
- ];
- }
-
- if(!(/^(document|window|parent)$/).test(o.containment)) {
- ce = $(o.containment)[0];
- co = $(o.containment).offset();
- over = ($(ce).css("overflow") !== "hidden");
-
- this.containment = [
- co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
- co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
- co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
- co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
- ];
- }
-
- },
-
- _convertPositionTo: function(d, pos) {
-
- if(!pos) {
- pos = this.position;
- }
- var mod = d === "absolute" ? 1 : -1,
- scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
- scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
-
- return {
- top: (
- pos.top + // The absolute mouse position
- this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
- ),
- left: (
- pos.left + // The absolute mouse position
- this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
- )
- };
-
- },
-
- _generatePosition: function(event) {
-
- var top, left,
- o = this.options,
- pageX = event.pageX,
- pageY = event.pageY,
- scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
-
- // This is another very weird special case that only happens for relative elements:
- // 1. If the css position is relative
- // 2. and the scroll parent is the document or similar to the offset parent
- // we have to refresh the relative offset during the scroll so there are no jumps
- if(this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {
- this.offset.relative = this._getRelativeOffset();
- }
-
- /*
- * - Position constraining -
- * Constrain the position to a mix of grid, containment.
- */
-
- if(this.originalPosition) { //If we are not dragging yet, we won't check for options
-
- if(this.containment) {
- if(event.pageX - this.offset.click.left < this.containment[0]) {
- pageX = this.containment[0] + this.offset.click.left;
- }
- if(event.pageY - this.offset.click.top < this.containment[1]) {
- pageY = this.containment[1] + this.offset.click.top;
- }
- if(event.pageX - this.offset.click.left > this.containment[2]) {
- pageX = this.containment[2] + this.offset.click.left;
- }
- if(event.pageY - this.offset.click.top > this.containment[3]) {
- pageY = this.containment[3] + this.offset.click.top;
- }
- }
-
- if(o.grid) {
- top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
- pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
-
- left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
- pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
- }
-
- }
-
- return {
- top: (
- pageY - // The absolute mouse position
- this.offset.click.top - // Click offset (relative to the element)
- this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
- ),
- left: (
- pageX - // The absolute mouse position
- this.offset.click.left - // Click offset (relative to the element)
- this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
- )
- };
-
- },
-
- _rearrange: function(event, i, a, hardRefresh) {
-
- a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
-
- //Various things done here to improve the performance:
- // 1. we create a setTimeout, that calls refreshPositions
- // 2. on the instance, we have a counter variable, that get's higher after every append
- // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
- // 4. this lets only the last addition to the timeout stack through
- this.counter = this.counter ? ++this.counter : 1;
- var counter = this.counter;
-
- this._delay(function() {
- if(counter === this.counter) {
- this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
- }
- });
-
- },
-
- _clear: function(event, noPropagation) {
-
- this.reverting = false;
- // We delay all events that have to be triggered to after the point where the placeholder has been removed and
- // everything else normalized again
- var i,
- delayedTriggers = [];
-
- // We first have to update the dom position of the actual currentItem
- // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
- if(!this._noFinalSort && this.currentItem.parent().length) {
- this.placeholder.before(this.currentItem);
- }
- this._noFinalSort = null;
-
- if(this.helper[0] === this.currentItem[0]) {
- for(i in this._storedCSS) {
- if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
- this._storedCSS[i] = "";
- }
- }
- this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
- } else {
- this.currentItem.show();
- }
-
- if(this.fromOutside && !noPropagation) {
- delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
- }
- if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
- delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
- }
-
- // Check if the items Container has Changed and trigger appropriate
- // events.
- if (this !== this.currentContainer) {
- if(!noPropagation) {
- delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
- delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
- delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
- }
- }
-
-
- //Post events to containers
- function delayEvent( type, instance, container ) {
- return function( event ) {
- container._trigger( type, event, instance._uiHash( instance ) );
- };
- }
- for (i = this.containers.length - 1; i >= 0; i--){
- if (!noPropagation) {
- delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
- }
- if(this.containers[i].containerCache.over) {
- delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
- this.containers[i].containerCache.over = 0;
- }
- }
-
- //Do what was originally in plugins
- if ( this.storedCursor ) {
- this.document.find( "body" ).css( "cursor", this.storedCursor );
- this.storedStylesheet.remove();
- }
- if(this._storedOpacity) {
- this.helper.css("opacity", this._storedOpacity);
- }
- if(this._storedZIndex) {
- this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
- }
-
- this.dragging = false;
-
- if(!noPropagation) {
- this._trigger("beforeStop", event, this._uiHash());
- }
-
- //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
- this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
-
- if ( !this.cancelHelperRemoval ) {
- if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
- this.helper.remove();
- }
- this.helper = null;
- }
-
- if(!noPropagation) {
- for (i=0; i < delayedTriggers.length; i++) {
- delayedTriggers[i].call(this, event);
- } //Trigger all delayed events
- this._trigger("stop", event, this._uiHash());
- }
-
- this.fromOutside = false;
- return !this.cancelHelperRemoval;
-
- },
-
- _trigger: function() {
- if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
- this.cancel();
- }
- },
-
- _uiHash: function(_inst) {
- var inst = _inst || this;
- return {
- helper: inst.helper,
- placeholder: inst.placeholder || $([]),
- position: inst.position,
- originalPosition: inst.originalPosition,
- offset: inst.positionAbs,
- item: inst.currentItem,
- sender: _inst ? _inst.element : null
- };
- }
-
-});
-
-
-
-}));
\ No newline at end of file
diff --git a/src/addons/sliders/lib/jquery.ui.widget.js b/src/addons/sliders/lib/jquery.ui.widget.js
deleted file mode 100644
index 9c07bc110..000000000
--- a/src/addons/sliders/lib/jquery.ui.widget.js
+++ /dev/null
@@ -1,521 +0,0 @@
-/*!
- * jQuery UI Widget 1.10.2
- * http://jqueryui.com
- *
- * Copyright 2013 jQuery Foundation and other contributors
- * Released under the MIT license.
- * http://jquery.org/license
- *
- * http://api.jqueryui.com/jQuery.widget/
- */
-(function( $, undefined ) {
-
-var uuid = 0,
- slice = Array.prototype.slice,
- _cleanData = $.cleanData;
-$.cleanData = function( elems ) {
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- try {
- $( elem ).triggerHandler( "remove" );
- // http://bugs.jquery.com/ticket/8235
- } catch( e ) {}
- }
- _cleanData( elems );
-};
-
-$.widget = function( name, base, prototype ) {
- var fullName, existingConstructor, constructor, basePrototype,
- // proxiedPrototype allows the provided prototype to remain unmodified
- // so that it can be used as a mixin for multiple widgets (#8876)
- proxiedPrototype = {},
- namespace = name.split( "." )[ 0 ];
-
- name = name.split( "." )[ 1 ];
- fullName = namespace + "-" + name;
-
- if ( !prototype ) {
- prototype = base;
- base = $.Widget;
- }
-
- // create selector for plugin
- $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
- return !!$.data( elem, fullName );
- };
-
- $[ namespace ] = $[ namespace ] || {};
- existingConstructor = $[ namespace ][ name ];
- constructor = $[ namespace ][ name ] = function( options, element ) {
- // allow instantiation without "new" keyword
- if ( !this._createWidget ) {
- return new constructor( options, element );
- }
-
- // allow instantiation without initializing for simple inheritance
- // must use "new" keyword (the code above always passes args)
- if ( arguments.length ) {
- this._createWidget( options, element );
- }
- };
- // extend with the existing constructor to carry over any static properties
- $.extend( constructor, existingConstructor, {
- version: prototype.version,
- // copy the object used to create the prototype in case we need to
- // redefine the widget later
- _proto: $.extend( {}, prototype ),
- // track widgets that inherit from this widget in case this widget is
- // redefined after a widget inherits from it
- _childConstructors: []
- });
-
- basePrototype = new base();
- // we need to make the options hash a property directly on the new instance
- // otherwise we'll modify the options hash on the prototype that we're
- // inheriting from
- basePrototype.options = $.widget.extend( {}, basePrototype.options );
- $.each( prototype, function( prop, value ) {
- if ( !$.isFunction( value ) ) {
- proxiedPrototype[ prop ] = value;
- return;
- }
- proxiedPrototype[ prop ] = (function() {
- var _super = function() {
- return base.prototype[ prop ].apply( this, arguments );
- },
- _superApply = function( args ) {
- return base.prototype[ prop ].apply( this, args );
- };
- return function() {
- var __super = this._super,
- __superApply = this._superApply,
- returnValue;
-
- this._super = _super;
- this._superApply = _superApply;
-
- returnValue = value.apply( this, arguments );
-
- this._super = __super;
- this._superApply = __superApply;
-
- return returnValue;
- };
- })();
- });
- constructor.prototype = $.widget.extend( basePrototype, {
- // TODO: remove support for widgetEventPrefix
- // always use the name + a colon as the prefix, e.g., draggable:start
- // don't prefix for widgets that aren't DOM-based
- widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
- }, proxiedPrototype, {
- constructor: constructor,
- namespace: namespace,
- widgetName: name,
- widgetFullName: fullName
- });
-
- // If this widget is being redefined then we need to find all widgets that
- // are inheriting from it and redefine all of them so that they inherit from
- // the new version of this widget. We're essentially trying to replace one
- // level in the prototype chain.
- if ( existingConstructor ) {
- $.each( existingConstructor._childConstructors, function( i, child ) {
- var childPrototype = child.prototype;
-
- // redefine the child widget using the same prototype that was
- // originally used, but inherit from the new version of the base
- $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
- });
- // remove the list of existing child constructors from the old constructor
- // so the old child constructors can be garbage collected
- delete existingConstructor._childConstructors;
- } else {
- base._childConstructors.push( constructor );
- }
-
- $.widget.bridge( name, constructor );
-};
-
-$.widget.extend = function( target ) {
- var input = slice.call( arguments, 1 ),
- inputIndex = 0,
- inputLength = input.length,
- key,
- value;
- for ( ; inputIndex < inputLength; inputIndex++ ) {
- for ( key in input[ inputIndex ] ) {
- value = input[ inputIndex ][ key ];
- if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
- // Clone objects
- if ( $.isPlainObject( value ) ) {
- target[ key ] = $.isPlainObject( target[ key ] ) ?
- $.widget.extend( {}, target[ key ], value ) :
- // Don't extend strings, arrays, etc. with objects
- $.widget.extend( {}, value );
- // Copy everything else by reference
- } else {
- target[ key ] = value;
- }
- }
- }
- }
- return target;
-};
-
-$.widget.bridge = function( name, object ) {
- var fullName = object.prototype.widgetFullName || name;
- $.fn[ name ] = function( options ) {
- var isMethodCall = typeof options === "string",
- args = slice.call( arguments, 1 ),
- returnValue = this;
-
- // allow multiple hashes to be passed on init
- options = !isMethodCall && args.length ?
- $.widget.extend.apply( null, [ options ].concat(args) ) :
- options;
-
- if ( isMethodCall ) {
- this.each(function() {
- var methodValue,
- instance = $.data( this, fullName );
- if ( !instance ) {
- return $.error( "cannot call methods on " + name + " prior to initialization; " +
- "attempted to call method '" + options + "'" );
- }
- if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
- return $.error( "no such method '" + options + "' for " + name + " widget instance" );
- }
- methodValue = instance[ options ].apply( instance, args );
- if ( methodValue !== instance && methodValue !== undefined ) {
- returnValue = methodValue && methodValue.jquery ?
- returnValue.pushStack( methodValue.get() ) :
- methodValue;
- return false;
- }
- });
- } else {
- this.each(function() {
- var instance = $.data( this, fullName );
- if ( instance ) {
- instance.option( options || {} )._init();
- } else {
- $.data( this, fullName, new object( options, this ) );
- }
- });
- }
-
- return returnValue;
- };
-};
-
-$.Widget = function( /* options, element */ ) {};
-$.Widget._childConstructors = [];
-
-$.Widget.prototype = {
- widgetName: "widget",
- widgetEventPrefix: "",
- defaultElement: "