diff --git a/Gruntfile.js b/Gruntfile.js index 31730ad34..f4f2c33e7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,7 +28,7 @@ module.exports = function (grunt) { 'src/data/**/*.js', 'src/config.js' ], - dest: 'dist/core.js' + dest: 'docs/core.js' }, biCoreJs: { src: [ @@ -83,7 +83,7 @@ module.exports = function (grunt) { 'src/base/tree/parttree.js', 'src/base/**/*.js' ], - dest: 'dist/base.js' + dest: 'docs/base.js' }, //实现好的一些基础实例 caseJs: { @@ -91,7 +91,7 @@ module.exports = function (grunt) { 'src/case/combo/popup.bubble.js', 'src/case/**/*.js' ], - dest: 'dist/case.js' + dest: 'docs/case.js' }, widgetJs: { src: [ @@ -100,32 +100,32 @@ module.exports = function (grunt) { 'src/widget/**/*.js', 'src/component/**/*.js' ], - dest: "dist/widget.js" + dest: "docs/widget.js" }, coreCss: { - src: ['src/css/core/**/*.css'], - dest: 'dist/core.css' + src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'], + dest: 'docs/core.css' }, baseCss: { src: ['src/css/base/**/*.css'], - dest: 'dist/base.css' + dest: 'docs/base.css' }, widgetCss: { src: ['src/css/widget/**/*.css'], - dest: 'dist/widget.css' + dest: 'docs/widget.css' }, resourceCss: { src: ['src/css/resource/**/*.css'], - dest: 'dist/resource.css' + dest: 'docs/resource.css' }, demoJs: { src: ['demo/version.js', 'demo/app.js', 'demo/js/**/*.js', 'demo/config.js'], - dest: 'demo/dist/demo.js' + dest: 'docs/demo.js' }, demoCss: { src: ['demo/css/**/*.css'], - dest: 'demo/dist/demo.css' + dest: 'docs/demo.css' }, bi_coreJs: { @@ -202,7 +202,7 @@ module.exports = function (grunt) { dest: "bi/widget.js" }, bi_coreCss: { - src: ['src/css/core/**/*.css'], + src: ['src/css/core/**/*.css', 'src/css/theme/**/*.css'], dest: 'bi/core.css' }, bi_baseCss: { @@ -237,9 +237,9 @@ module.exports = function (grunt) { }, dist: { files: { - 'dist/core.min.js': ['<%= concat.coreJs.dest %>'], - 'dist/base.min.js': ['<%= concat.baseJs.dest %>'], - 'dist/case.min.js': ['<%= concat.caseJs.dest %>'] + 'docs/core.min.js': ['<%= concat.coreJs.dest %>'], + 'docs/base.min.js': ['<%= concat.baseJs.dest %>'], + 'docs/case.min.js': ['<%= concat.caseJs.dest %>'] } } }, @@ -250,14 +250,14 @@ module.exports = function (grunt) { src: '<%= concat.coreCss.dest %>', - dest: 'dist/core.min.css' + dest: 'docs/core.min.css' }, baseCss: { src: '<%= concat.baseCss.dest %>', - dest: 'dist/base.min.css' + dest: 'docs/base.min.css' } diff --git a/README.md b/README.md index b96b7abae..d0e91865b 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -FineUI \ No newline at end of file +FineUI + +主页地址:[https://fanruan.github.io/fineui](https://fanruan.github.io/fineui) + +帆软BI和帆软报表所使用的前端UI框架。 \ No newline at end of file diff --git a/bi/base.css b/bi/base.css index d9a49fee4..239c28f0b 100644 --- a/bi/base.css +++ b/bi/base.css @@ -4,17 +4,6 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ -.bi-combine-chart .bi-linkage-list { - background-color: #ffffff; - border: 1px solid #eaeaea; - z-index: 1000000000; -} -.bi-combine-chart .bi-linkage-list .bi-linkage-list-item:hover { - background-color: #f4f4f4; -} -/****添加计算宽度的--运算符直接需要space****/ -/****** common color(常用颜色,可用于普遍场景) *****/ -/**** custom color(自定义颜色,用于特定场景) ****/ .bi-color-chooser-popup .color-chooser-popup-title { background: #f4f4f4; border-bottom: 1px solid #d4dadd; @@ -949,13 +938,6 @@ li.CodeMirror-hint-active { /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ -.bi-record-editor .record-editor-text { - font-size: 12px; - background: #f4f4f4; -} -/****添加计算宽度的--运算符直接需要space****/ -/****** common color(常用颜色,可用于普遍场景) *****/ -/**** custom color(自定义颜色,用于特定场景) ****/ .bi-shelter-editor .shelter-editor-text { font-size: 12px; } @@ -1021,9 +1003,6 @@ li.CodeMirror-hint-active { border: none; color: #e85050 !important; } -.bi-input.disabled { - background-color: white; -} /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ @@ -1206,6 +1185,7 @@ li.CodeMirror-hint-active { transition-timing-function: ease; user-select: none; background-color: rgba(0, 0, 0, 0.1); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000,endColorstr=#19000000); border-radius: 5px; } .scrollbar-layout-main-vertical { @@ -1225,6 +1205,7 @@ li.CodeMirror-hint-active { left: 0; transition-property: background-color; background-color: rgba(0, 0, 0, 0.1); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19000000,endColorstr=#19000000); } /* Touching the scroll-track directly makes the scroll-track bolder */ .scrollbar-layout-main-horizontal.public-scrollbar-main-active, @@ -1279,11 +1260,19 @@ li.CodeMirror-hint-active { .public-scrollbar-face:after { background-color: #c2c2c2; } +.bi-theme-dark .public-scrollbar-face:after { + background-color: #7d7d7d; +} .public-scrollbar-main:hover .public-scrollbar-face:after, .public-scrollbar-main-active .public-scrollbar-face:after, .public-scrollbar-faceActive:after { background-color: #7d7d7d; } +.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after, +.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after, +.bi-theme-dark .public-scrollbar-faceActive:after { + background-color: #c2c2c2; +} .horizontal-scrollbar { bottom: 0; position: absolute; @@ -1437,3 +1426,7 @@ li.CodeMirror-hint-active { .bi-list-view .list-view-toolbar > .first-element { border-left: none; } +.bi-theme-dark .bi-list-view .list-view-outer { + color: #b2b2b2; + background: #191a2c; +} diff --git a/bi/base.js b/bi/base.js index 41d9f2b6f..887230249 100644 --- a/bi/base.js +++ b/bi/base.js @@ -42,9 +42,6 @@ } else { this.onmousewheel = handler; } - // Store the line height and page height for this particular element - $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); - $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); }, teardown: function() { @@ -55,22 +52,6 @@ } else { this.onmousewheel = null; } - // Clean up the data we added to the element - $.removeData(this, 'mousewheel-line-height'); - $.removeData(this, 'mousewheel-page-height'); - }, - - getLineHeight: function(elem) { - var $elem = $(elem), - $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); - if (!$parent.length) { - $parent = $('body'); - } - return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; - }, - - getPageHeight: function(elem) { - return $(elem).height(); }, settings: { @@ -136,12 +117,12 @@ // * deltaMode 1 is by lines // * deltaMode 2 is by pages if ( orgEvent.deltaMode === 1 ) { - var lineHeight = $.data(this, 'mousewheel-line-height'); + var lineHeight = 40; delta *= lineHeight; deltaY *= lineHeight; deltaX *= lineHeight; } else if ( orgEvent.deltaMode === 2 ) { - var pageHeight = $.data(this, 'mousewheel-page-height'); + var pageHeight = 800; delta *= pageHeight; deltaY *= pageHeight; deltaX *= pageHeight; @@ -1489,10 +1470,6 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); - - - - this._stop = false; this.container = BI.createWidget(); @@ -1969,10 +1946,10 @@ BI.TreeView = BI.inherit(BI.Pane, { } }); BI.extend(BI.TreeView, { - REQ_TYPE_INIT_DATA: 1, - REQ_TYPE_ADJUST_DATA: 2, - REQ_TYPE_CALCULATE_SELECT_DATA: 3, - REQ_TYPE_SELECTED_DATA: 4 + REQ_TYPE_INIT_DATA: 0, + REQ_TYPE_ADJUST_DATA: 1, + REQ_TYPE_CALCULATE_SELECT_DATA: 2, + REQ_TYPE_SELECTED_DATA: 3 }); BI.TreeView.EVENT_CHANGE = "EVENT_CHANGE"; @@ -3920,12 +3897,9 @@ BI.Navigation = BI.inherit(BI.Widget, { logic: { dynamic: false }, - defaultShowIndex: 0, - tab: { - type: "bi.button_group", - items: [], - layouts: [] - }, + single: false, + defaultShowIndex: false, + tab: false, cardCreator: function (v) { return BI.createWidget(); }, @@ -3963,7 +3937,7 @@ BI.Navigation = BI.inherit(BI.Widget, { }, afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardShow: BI.bind(this.afterCardShow, this) - }) + }); }, mounted: function () { @@ -3973,6 +3947,18 @@ BI.Navigation = BI.inherit(BI.Widget, { } }, + _deleteOtherCards: function (currCardName) { + var self = this, o = this.options; + if (o.single === true) { + BI.each(this.cardMap, function (name, card) { + if (name !== (currCardName + "")) { + self.layout.deleteCardByName(name); + delete self.cardMap[name]; + } + }); + } + }, + afterCardCreated: function (v) { var self = this; this.cardMap[v].on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { @@ -3980,12 +3966,13 @@ BI.Navigation = BI.inherit(BI.Widget, { if (type === BI.Events.CLICK) { self.fireEvent(BI.Navigation.EVENT_CHANGE, obj); } - }) + }); this.options.afterCardCreated.apply(this, arguments); }, afterCardShow: function (v) { this.showIndex = v; + this._deleteOtherCards(v); this.options.afterCardShow.apply(this, arguments); }, @@ -3996,16 +3983,23 @@ BI.Navigation = BI.inherit(BI.Widget, { } }, - setSelect: function (v) { - this.showIndex = v; + _assertCard: function (v) { if (!this.layout.isCardExisted(v)) { var card = this.options.cardCreator(v); this.cardMap[v] = card; this.layout.addCardByName(v, card); this.afterCardCreated(v); } + }, + + setSelect: function (v) { + this._assertCard(); this.layout.showCardByName(v); - BI.nextTick(BI.bind(this.afterCardShow, this, v)); + this._deleteOtherCards(v); + if (this.showIndex !== v) { + this.showIndex = v; + BI.nextTick(BI.bind(this.afterCardShow, this, v)); + } }, getSelect: function () { @@ -4636,6 +4630,7 @@ BI.Tab = BI.inherit(BI.Widget, { return BI.extend(BI.Tab.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-tab", direction: "top",//top, bottom, left, right, custom + single: false, //是不是单页面 logic: { dynamic: false }, @@ -4675,6 +4670,7 @@ BI.Tab = BI.inherit(BI.Widget, { return card; }, afterCardShow: function (v) { + self._deleteOtherCards(v); self.curr = v; } }); @@ -4683,6 +4679,18 @@ BI.Tab = BI.inherit(BI.Widget, { }); }, + _deleteOtherCards: function (currCardName) { + var self = this, o = this.options; + if (o.single === true) { + BI.each(this.cardMap, function (name, card) { + if (name !== (currCardName + "")) { + self.layout.deleteCardByName(name); + delete self.cardMap[name]; + } + }); + } + }, + _assertCard: function (v) { if (!this.layout.isCardExisted(v)) { var card = this.options.cardCreator(v); @@ -4702,6 +4710,7 @@ BI.Tab = BI.inherit(BI.Widget, { this.tab && this.tab.setValue(v); this._assertCard(v); this.layout.showCardByName(v); + this._deleteOtherCards(v); if (this.curr !== v) { this.curr = v; } @@ -17951,6 +17960,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { setValue: function (value) { this.content.element.val(value); + this._checkWaterMark(); }, setStyle: function (style) { @@ -28297,8 +28307,7 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.CollectionTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -28434,6 +28443,10 @@ BI.CollectionTable = BI.inherit(BI.Widget, { }); this._width = o.width - BI.GridTableScrollbar.SIZE; this._height = o.height - BI.GridTableScrollbar.SIZE; + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0 || o.header.length < 0) { this._digest(); this._populate(); @@ -28832,8 +28845,8 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { }); }, - _init: function () { - BI.QuickCollectionTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickCollectionTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftCollection.setOverflowX(false); this.topLeftCollection.setOverflowY(false); @@ -28843,6 +28856,11 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { this.bottomLeftCollection.setOverflowY(false); this.bottomRightCollection.setOverflowX(false); this.bottomRightCollection.setOverflowY(false); + }, + + mounted: function () { + BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), @@ -29037,8 +29055,7 @@ BI.GridTable = BI.inherit(BI.Widget, { }); }, - _init: function () { - BI.GridTable.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this._width = 0; this._height = 0; @@ -29181,6 +29198,10 @@ BI.GridTable = BI.inherit(BI.Widget, { this._height = o.height - BI.GridTableScrollbar.SIZE; this.header = this._getHeader(); this.items = this._getItems(); + }, + + mounted: function () { + var o = this.options; if (o.items.length > 0) { this._populate(); } @@ -29499,8 +29520,8 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { }); }, - _init: function () { - BI.QuickGridTable.superclass._init.apply(this, arguments); + render: function () { + BI.QuickGridTable.superclass.render.apply(this, arguments); var self = this, o = this.options; this.topLeftGrid.setOverflowX(false); this.topLeftGrid.setOverflowY(false); @@ -29510,6 +29531,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { this.bottomLeftGrid.setOverflowY(false); this.bottomRightGrid.setOverflowX(false); this.bottomRightGrid.setOverflowY(false); + }, + + mounted: function () { + BI.QuickGridTable.superclass.mounted.apply(this, arguments); + var self = this; this._leftWheelHandler = new BI.WheelHandler( BI.bind(this._onWheelY, this), BI.bind(this._shouldHandleX, this), @@ -29679,8 +29705,7 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { }) }, - _init: function () { - BI.GridTableScrollbar.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; this.focused = false; this.isDragging = false; @@ -29698,6 +29723,10 @@ BI.GridTableScrollbar = BI.inherit(BI.Widget, { top: 0 }] }); + }, + + mounted: function () { + var self = this, o = this.options; var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY; this._wheelHandler = new BI.WheelHandler( BI.bind(onWheel, this), @@ -30052,6 +30081,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, { populate: function () { this.scrollbar.populate(); + var o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); } }); BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; @@ -30973,11 +31008,9 @@ BI.Table = BI.inherit(BI.Widget, { }; this._initNormalScroll(); - BI.Resizers.add(this.getName(), function (e) { - if (self.element.is(":visible") && BI.isWindow(e.target)) { - self._resize(); - self.fireEvent(BI.Table.EVENT_TABLE_RESIZE); - } + BI.ResizeDetector.addResizeListener(this, function () { + self._resize(); + self.fireEvent(BI.Table.EVENT_TABLE_RESIZE); }); BI.nextTick(function () { if (self.element.is(":visible")) { @@ -32003,7 +32036,6 @@ BI.Table = BI.inherit(BI.Widget, { }, empty: function () { - BI.Resizers.remove(this.getName()); BI.Table.superclass.empty.apply(this, arguments); }, diff --git a/bi/case.js b/bi/case.js index 86cab3357..1ec01058d 100644 --- a/bi/case.js +++ b/bi/case.js @@ -5225,232 +5225,6 @@ BI.ClearEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE"; BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.shortcut("bi.clear_editor", BI.ClearEditor);/** - * guy - * 记录内容的输入框 - * @class BI.RecordEditor - * @extends BI.Single - */ -BI.RecordEditor = BI.inherit(BI.Single, { - _defaultConfig: function () { - var conf = BI.RecordEditor.superclass._defaultConfig.apply(this, arguments); - return BI.extend(conf, { - baseCls: (conf.baseCls || "") + " bi-record-editor", - hgap: 4, - vgap: 2, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - validationChecker: BI.emptyFn, - quitChecker: BI.emptyFn, - allowBlank: true, - watermark: "", - errorText: "", - height: 30 - }) - }, - - _init: function () { - BI.RecordEditor.superclass._init.apply(this, arguments); - this.contents = []; - var self = this, o = this.options; - - this.editor = BI.createWidget({ - type: "bi.editor", - height: o.height, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - value: o.value, - validationChecker: o.validationChecker, - quitChecker: o.quitChecker, - mouseOut: o.mouseOut, - allowBlank: o.allowBlank, - watermark: o.watermark, - errorText: o.errorText - }); - this.textContainer = BI.createWidget({ - type: "bi.vertical_adapt", - hgap: 2, - height: o.height - }); - this.editor.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.editor.on(BI.Editor.EVENT_FOCUS, function () { - self._checkInputState(); - self.fireEvent(BI.RecordEditor.EVENT_FOCUS, arguments); - }); - this.editor.on(BI.Editor.EVENT_BLUR, function () { - self._checkInputState(); - self.fireEvent(BI.RecordEditor.EVENT_BLUR, arguments); - }); - this.editor.on(BI.Editor.EVENT_CLICK, function () { - self.fireEvent(BI.RecordEditor.EVENT_CLICK, arguments); - }); - this.editor.on(BI.Editor.EVENT_CHANGE, function () { - self.fireEvent(BI.RecordEditor.EVENT_CHANGE, arguments); - }); - this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { - self.fireEvent(BI.RecordEditor.EVENT_KEY_DOWN, arguments); - }); - - this.editor.on(BI.Editor.EVENT_VALID, function () { - self.fireEvent(BI.RecordEditor.EVENT_VALID, arguments); - }); - this.editor.on(BI.Editor.EVENT_SPACE, function () { - self.fireEvent(BI.RecordEditor.EVENT_SPACE, arguments); - }); - this.editor.on(BI.Editor.EVENT_CONFIRM, function () { - self.setState(self.getValue()); - self.editor.isValid() && self.editor.setValue(""); - self.fireEvent(BI.RecordEditor.EVENT_CONFIRM, arguments); - }); - this.editor.on(BI.Editor.EVENT_START, function () { - self.fireEvent(BI.RecordEditor.EVENT_START, arguments); - }); - this.editor.on(BI.Editor.EVENT_PAUSE, function () { - self.fireEvent(BI.RecordEditor.EVENT_PAUSE, arguments); - }); - this.editor.on(BI.Editor.EVENT_STOP, function () { - self.fireEvent(BI.RecordEditor.EVENT_STOP, arguments); - }); - this.editor.on(BI.Editor.EVENT_ENTER, function () { - self.fireEvent(BI.RecordEditor.EVENT_ENTER, arguments); - }); - this.editor.on(BI.Editor.EVENT_BACKSPACE, function () { - self._checkInputState(); - }); - this.editor.on(BI.Editor.EVENT_REMOVE, function () { - if (!BI.isEmpty(self.contents)) { - self.contents.pop().destroy(); - self.setValue(self.getValue()); - self._adjustInputWidth(); - } - }); - this.editor.on(BI.Editor.EVENT_ERROR, function () { - self.fireEvent(BI.RecordEditor.EVENT_ERROR, arguments); - }); - this.editor.on(BI.Editor.EVENT_RESTRICT, function () { - self.fireEvent(BI.RecordEditor.EVENT_RESTRICT, arguments); - }); - this.editor.on(BI.Editor.EVENT_EMPTY, function () { - self.fireEvent(BI.RecordEditor.EVENT_EMPTY, arguments); - }); - BI.createWidget({ - type: "bi.inline", - element: this, - items: [this.textContainer, this.editor] - }); - BI.ResizeDetector.addResizeListener(this, BI.bind(this._adjustInputWidth, this)); - this._adjustInputWidth(); - }, - - _adjustInputWidth: function () { - BI.nextTick(BI.bind(function () { - this.editor.element.css("width", this.element.width() - this.textContainer.element.outerWidth() - 10); - }, this)); - }, - - _checkInputState: function () { - if (BI.isEmpty(this.contents)) { - this.editor.enableWarterMark(); - } else { - this.editor.disableWarterMark(); - } - }, - - focus: function () { - this.editor.focus(); - }, - - blur: function () { - this.editor.blur(); - }, - - isValid: function () { - return this.editor.isValid(); - }, - - setErrorText: function (text) { - this.editor.setErrorText(text); - }, - - getErrorText: function () { - return this.editor.getErrorText(); - }, - - isEditing: function () { - return this.editor.isEditing(); - }, - - getLastValidValue: function () { - return this.editor.getLastValidValue(); - }, - - setValue: function (k) { - this.editor.setValue(k); - }, - - getValue: function () { - return this.editor.getValue(); - }, - - getState: function () { - var values = BI.map(this.contents, function (i, lb) { - return lb.getText(); - }); - if (BI.isNotEmptyString(this.editor.getValue())) { - return values.concat([this.editor.getValue()]); - } - return values; - }, - - setState: function (v) { - BI.RecordEditor.superclass.setValue.apply(this, arguments); - v = BI.isArray(v) ? v : (v == "" ? [] : [v]); - var contents = this.contents = []; - BI.each(v, function (i, lb) { - contents.push(BI.createWidget({ - type: "bi.label", - height: 25, - cls: "record-editor-text", - text: lb - })) - }); - this.textContainer.empty(); - this.textContainer.populate(contents); - this.editor.isValid() && this.editor.setValue(""); - this._checkInputState(); - this._adjustInputWidth(); - }, - - destroy: function () { - BI.Resizers.remove(this.getName()); - BI.RecordEditor.superclass.destroy.apply(this, arguments); - } -}); -BI.RecordEditor.EVENT_CHANGE = "EVENT_CHANGE"; -BI.RecordEditor.EVENT_FOCUS = "EVENT_FOCUS"; -BI.RecordEditor.EVENT_BLUR = "EVENT_BLUR"; -BI.RecordEditor.EVENT_CLICK = "EVENT_CLICK"; -BI.RecordEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; - -BI.RecordEditor.EVENT_START = "EVENT_START"; -BI.RecordEditor.EVENT_PAUSE = "EVENT_PAUSE"; -BI.RecordEditor.EVENT_STOP = "EVENT_STOP"; -BI.RecordEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; -BI.RecordEditor.EVENT_VALID = "EVENT_VALID"; -BI.RecordEditor.EVENT_ERROR = "EVENT_ERROR"; -BI.RecordEditor.EVENT_ENTER = "EVENT_ENTER"; -BI.RecordEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; -BI.RecordEditor.EVENT_SPACE = "EVENT_SPACE"; -BI.RecordEditor.EVENT_EMPTY = "EVENT_EMPTY"; - -BI.shortcut("bi.record_editor", BI.RecordEditor);/** * Created by roy on 15/9/14. */ BI.SearchEditor = BI.inherit(BI.Widget, { @@ -8614,6 +8388,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, { }) }, + alwaysShowPager: true, + setAllPages: function (v) { this.allPages.setText("/" + v); this.allPages.setTitle(v); @@ -8648,10 +8424,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, { this.pager.setVisible(b); }, - getAliasWidth: function () { - return this.options.width - 100; - }, - populate: function () { this.pager.populate(); } @@ -8908,6 +8680,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, { this.setVPagerVisible(true); vShow = true; } + this.setVisible(hShow || vShow); var num = [74, 111, -9, 28]; var items = this.layout.attr("items"); @@ -9362,10 +9135,6 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, { regionColumnSize: [], - headerCellStyleGetter: BI.emptyFn, - summaryCellStyleGetter: BI.emptyFn, - sequenceCellStyleGetter: BI.emptyFn, - header: [], items: [], //二维数组 @@ -9402,10 +9171,6 @@ BI.AdaptiveTable = BI.inherit(BI.Widget, { regionColumnSize: data.regionColumnSize, - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter, - header: o.header, items: o.items, //交叉表头 @@ -9587,6 +9352,8 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, { mergeRule: BI.emptyFn, columnSize: [], + minColumnSize: [], + maxColumnSize: [], headerRowSize: 25, footerRowSize: 25, rowSize: 25, @@ -9770,9 +9537,6 @@ BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, { headerRowSize: o.headerRowSize, rowSize: o.rowSize, regionColumnSize: o.regionColumnSize, - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter, header: data.header, items: data.items }); @@ -9919,6 +9683,8 @@ BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { mergeRule: BI.emptyFn, columnSize: [], + minColumnSize: [], + maxColumnSize: [], headerRowSize: 25, footerRowSize: 25, rowSize: 25, @@ -9968,15 +9734,13 @@ BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { mergeRule: o.mergeRule, 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: data.header, items: data.items }); @@ -9985,12 +9749,18 @@ BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { }); this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { o.regionColumnSize = this.getRegionColumnSize(); - o.columnSize = this.getColumnSize(); + var columnSize = this.getColumnSize(); + var length = o.columnSize.length - columnSize.length; + o.columnSize = columnSize.slice(); + o.columnSize.splice(columnSize.length, length, ""); 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(); + var columnSize = this.getColumnSize(); + var length = o.columnSize.length - columnSize.length; + o.columnSize = columnSize.slice(); + o.columnSize.splice(columnSize.length, length, ""); self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); }); }, @@ -10032,7 +9802,7 @@ BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { }, getColumnSize: function () { - return this.table.getColumnSize(); + return this.options.columnSize; }, setRegionColumnSize: function (columnSize) { @@ -10227,12 +9997,19 @@ BI.extend(BI.DynamicSummaryTreeTable, { }); if (cols.length > 0) { + var nHeader = [], nItems = []; BI.each(header, function (i, node) { - BI.removeAt(node, cols); + var nNode = node.slice(); + BI.removeAt(nNode, cols); + nHeader.push(nNode); }); BI.each(items, function (i, node) { - BI.removeAt(node, cols); + var nNode = node.slice(); + BI.removeAt(nNode, cols); + nItems.push(nNode);; }); + header = nHeader; + items = nItems; } return {items: items, header: header, deletedCols: cols}; } @@ -10428,9 +10205,6 @@ BI.LayerTreeTable = BI.inherit(BI.Widget, { headerRowSize: o.headerRowSize, rowSize: o.rowSize, regionColumnSize: o.regionColumnSize, - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter, header: data.header, items: data.items }); @@ -10682,10 +10456,6 @@ BI.TableTree = BI.inherit(BI.Widget, { regionColumnSize: o.regionColumnSize, - headerCellStyleGetter: o.headerCellStyleGetter, - summaryCellStyleGetter: o.summaryCellStyleGetter, - sequenceCellStyleGetter: o.sequenceCellStyleGetter, - header: data.header, items: data.items }); diff --git a/bi/core.css b/bi/core.css index c94ea5fe6..42772d827 100644 --- a/bi/core.css +++ b/bi/core.css @@ -2958,6 +2958,16 @@ .bi-list-item.disabled:active { background-color: #ffffff; } +.bi-theme-dark .bi-list-item:hover, +.bi-theme-dark .bi-list-item.hover { + background-color: #04070d; + color: #ffffff; +} +.bi-theme-dark .bi-list-item.disabled, +.bi-theme-dark .bi-list-item.disabled:hover, +.bi-theme-dark .bi-list-item.disabled:active { + background-color: transparent; +} .bi-list-item-effect.active, .bi-list-item-effect:active { color: #009de3; @@ -2965,7 +2975,16 @@ .bi-list-item-effect.disabled, .bi-list-item-effect.disabled:hover, .bi-list-item-effect.disabled:active { - color: #1a1a1a; + color: #c4c6c6; +} +.bi-theme-dark .bi-list-item-effect.active, +.bi-theme-dark .bi-list-item-effect:active { + color: #009de3; +} +.bi-theme-dark .bi-list-item-effect.disabled, +.bi-theme-dark .bi-list-item-effect.disabled:hover, +.bi-theme-dark .bi-list-item-effect.disabled:active { + color: #c4c6c6; } .bi-list-item-hover:hover, .bi-list-item-hover.hover { @@ -2975,9 +2994,20 @@ .bi-list-item-hover.disabled, .bi-list-item-hover.disabled:hover, .bi-list-item-hover.disabled:active { - color: #1a1a1a; + color: #c4c6c6; background-color: #ffffff; } +.bi-theme-dark .bi-list-item-hover:hover, +.bi-theme-dark .bi-list-item-hover.hover { + color: #009de3; + background-color: #04070d; +} +.bi-theme-dark .bi-list-item-hover.disabled, +.bi-theme-dark .bi-list-item-hover.disabled:hover, +.bi-theme-dark .bi-list-item-hover.disabled:active { + color: #c4c6c6; + background-color: transparent; +} .bi-list-item-active:hover, .bi-list-item-active.hover { background-color: #f4f4f4; @@ -2992,6 +3022,21 @@ .bi-list-item-active.disabled:active { background-color: #ffffff; } +.bi-theme-dark .bi-list-item-active:hover, +.bi-theme-dark .bi-list-item-active.hover { + background-color: #04070d; + color: #ffffff; +} +.bi-theme-dark .bi-list-item-active.active, +.bi-theme-dark .bi-list-item-active:active { + color: #009de3; + background-color: #04070d; +} +.bi-theme-dark .bi-list-item-active.disabled, +.bi-theme-dark .bi-list-item-active.disabled:hover, +.bi-theme-dark .bi-list-item-active.disabled:active { + background-color: transparent; +} .bi-list-item-select:hover, .bi-list-item-select.hover { color: #009de3; @@ -3017,6 +3062,31 @@ .bi-list-item-select.disabled:active .bi-high-light { color: #c4c6c6 !important; } +.bi-theme-dark .list-item-select:hover, +.bi-theme-dark .list-item-select.hover { + color: #009de3; + background-color: #04070d; +} +.bi-theme-dark .list-item-select:active, +.bi-theme-dark .list-item-select.active { + color: #ffffff; + background-color: #009de3; +} +.bi-theme-dark .list-item-select:active .bi-high-light, +.bi-theme-dark .list-item-select.active .bi-high-light { + color: #ffffff; +} +.bi-theme-dark .list-item-select.disabled, +.bi-theme-dark .list-item-select.disabled:hover, +.bi-theme-dark .list-item-select.disabled:active { + color: #c4c6c6 !important; + background-color: transparent !important; +} +.bi-theme-dark .list-item-select.disabled .bi-high-light, +.bi-theme-dark .list-item-select.disabled:hover .bi-high-light, +.bi-theme-dark .list-item-select.disabled:active .bi-high-light { + color: #c4c6c6 !important; +} /*****************cursor*****************/ .cursor-pointer { cursor: pointer; @@ -3447,3 +3517,19 @@ vertical-align: middle; content: ' '; } +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-theme-dark { + background-color: #191a2c; + color: #b2b2b2; +} +.bi-theme-dark .bi-input { + color: #ffffff; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ diff --git a/bi/core.js b/bi/core.js index af139ef2a..d9b383c5d 100644 --- a/bi/core.js +++ b/bi/core.js @@ -1904,9 +1904,6 @@ if (!window.BI) { } ; !(function ($, undefined) { - _.extend(BI, { - version: "2.0" - }); var traverse = function (func, context) { return function (value, key, obj) { return func.call(context, key, value, obj); @@ -4487,6 +4484,10 @@ BI.Widget = BI.inherit(BI.OB, { this.destroyed && this.destroyed(); }, + isMounted: function () { + return this._isMounted; + }, + setWidth: function (w) { this.options.width = w; this._initElementWidth(); @@ -13289,7 +13290,7 @@ BI.CardLayout = BI.inherit(BI.Layout, { isCardExisted: function (cardName) { return BI.some(this.options.items, function (i, item) { - return item.cardName === cardName && item.el; + return item.cardName == cardName && item.el; }); }, @@ -15829,7 +15830,8 @@ BI.LayerController = BI.inherit(BI.Controller, { return this.get(name); } var widget = BI.createWidget((op.render || {}), { - type: "bi.layout" + type: "bi.layout", + cls: op.cls }); var layout = BI.createWidget({ type: "bi.absolute", @@ -16934,23 +16936,6 @@ $(function () { BI.Func = {}; var formulas = {}; BI.extend(BI.Func, { - /** - * 创建唯一的名字 - * @param array - * @param name - * @returns {*} - */ - createDistinctName: function (array, name) { - var src = name, idx = 1; - name = name || ""; - while (true) { - if (!ArrayUtils.getItemByName(array, name)) { - break; - } - name = src + (idx++); - } - return name; - }, /** * 获取搜索结果 @@ -16998,60 +16983,6 @@ $(function () { finded: finded } }, - - /** - * 公式合法性验证 - */ - checkFormulaValidation: function (str) { - if (!BI.isEmptyString(str)) { - if (BI.has(formulas, str)) { - return formulas[str]; - } - formulas[str] = false; - var response = BI.requestSync("fr_bi_base", "check_validation_of_expression", {expression: str}); - if (response.validation === "invalid") { - formulas[str] = false; - } else if (response.validation === "valid") { - formulas[str] = true; - } - return formulas[str]; - } else { - return true; - } - }, - - getFormulaStringFromFormulaValue: function (formulaValue) { - var formulaString = ""; - var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g; - var result = formulaValue.match(regx); - BI.each(result, function (i, item) { - var fieldRegx = /\$[\{][^\}]*[\}]/; - var str = item.match(fieldRegx); - if (BI.isNotEmptyArray(str)) { - formulaString = formulaString + str[0].substring(2, item.length - 1); - } else { - formulaString = formulaString + item; - } - }); - return formulaString; - }, - - formatAddress: function (address) { - var temp = ''; - var url1 = /[a-zA-z]+:\/\/[^\s]*/; - var url2 = /\/[^\s]*/; - if (address.match(url1) || address.match(url2)) { - temp = address; - } else if (BI.isNotEmptyString(address)) { - temp = "http://" + address; - } - return temp; - }, - - getCompleteImageUrl: function (url) { - return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url; - } - }); /** @@ -17104,24 +17035,26 @@ $(function () { }); }, - getImageWidthAndHeight: function (src) { - return BI.requestSync("fr_bi_base", "get_image_size", { - src: src - }); - }, - isDarkColor: function (hex) { if (!hex) { return false; } var rgb = this.rgb2json(this.hex2rgb(hex)); - var grayLevel = (rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114); - if (grayLevel < 192) { + var grayLevel = Math.round(rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114); + if (grayLevel < 140) { return true; } return false; }, + //获取对比颜色 + getContrastColor: function (color) { + if (this.isDarkColor(color)) { + return "#ffffff"; + } + return "#1a1a1a"; + }, + rgb2hex: function (rgbColour) { if (!rgbColour || rgbColour.substr(0, 3) != "rgb") { return ""; diff --git a/bi/widget.css b/bi/widget.css index 8b7bfd0aa..0d9edf19b 100644 --- a/bi/widget.css +++ b/bi/widget.css @@ -139,35 +139,12 @@ /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ -.bi-down-list-combo .down-list-group.bi-combo-hover .bi-down-list-group-item, -.bi-down-list-combo .down-list-group.bi-combo-hover .bi-down-list-group-item .b-font:before { - background-color: #f4f4f4; -} -.bi-down-list-combo .down-list-group.bi-combo-hover .bi-down-list-group-item:disabled, -.bi-down-list-combo .down-list-group.bi-combo-hover .bi-down-list-group-item.disabled, -.bi-down-list-combo .down-list-group.bi-combo-hover .bi-down-list-group-item:disabled .b-font:before, -.bi-down-list-combo .down-list-group.bi-combo-hover .bi-down-list-group-item.disabled .b-font:before { - background-color: #ffffff; -} .bi-down-list-combo .bi-down-list-spliter { border-top: 1px solid #eaeaea; } /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ -.bi-down-list-popup .bi-down-list-item:hover, -.bi-down-list-popup .bi-down-list-item.hover { - background-color: #f4f4f4; -} -.bi-down-list-popup .bi-down-list-item.disabled, -.bi-down-list-popup .bi-down-list-item.disabled:hover, -.bi-down-list-popup .bi-down-list-item.disabled:active { - background-color: #ffffff; -} -.bi-down-list-popup .bi-down-list-item:active { - color: #009de3; - background-color: #f4f4f4; -} .bi-down-list-popup .bi-down-list-item .list-item-text { max-width: 203px; } @@ -359,6 +336,9 @@ background-color: #ffffff; z-index: 1; } +.bi-theme-dark .bi-multi-select-check-selected-button { + background-color: #191a2c; +} /****添加计算宽度的--运算符直接需要space****/ /****** common color(常用颜色,可用于普遍场景) *****/ /**** custom color(自定义颜色,用于特定场景) ****/ diff --git a/bi/widget.js b/bi/widget.js index f3289fdcd..99ffd64b5 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -5222,7 +5222,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, { direction: "top", element: this, logic: { - dynamic: true + dynamic: false }, type: "bi.navigation", tab: this.datePicker, @@ -5250,7 +5250,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, { var calendar = BI.createWidget({ type: "bi.calendar", logic: { - dynamic: true + dynamic: false }, min: this.options.min, max: this.options.max, @@ -5670,7 +5670,7 @@ BI.shortcut("bi.down_list_group", BI.DownListGroup);BI.DownListItem = BI.inherit _defaultConfig: function () { var conf = BI.DownListItem.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { - baseCls: "bi-down-list-item", + baseCls: "bi-down-list-item bi-list-item-active", cls: "", height: 25, logic: { @@ -12846,7 +12846,7 @@ BI.PageTable = BI.inherit(BI.Widget, { this.table = BI.createWidget(o.el, { type: "bi.sequence_table", width: o.width, - height: o.height - 30, + height: o.height && o.height - 30, isNeedResize: true, isResizeAdapt: false, @@ -12905,7 +12905,7 @@ BI.PageTable = BI.inherit(BI.Widget, { vpage: vpage, hpage: hpage }, function (items, header, crossItems, crossHeader) { - self.table.setVPage ? self.table.setVPage(vpage) : self.table.setCurrentPage(vpage); + self.table.setVPage ? self.table.setVPage(vpage) : self.table.setValue(vpage); self.table.setHPage && self.table.setHPage(hpage); self.populate.apply(self, arguments); }); @@ -12970,7 +12970,23 @@ BI.PageTable = BI.inherit(BI.Widget, { setHeight: function (height) { BI.PageTable.superclass.setHeight.apply(this, arguments); - this.table.setHeight(height - 30); + 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)); }, setColumnSize: function (columnSize) { @@ -15957,7 +15973,7 @@ BI.SequenceTable = BI.inherit(BI.Widget, { headerRowSize: o.headerRowSize, rowSize: o.rowSize, width: 60, - height: o.height - BI.GridTableScrollbar.SIZE, + height: o.height && o.height - BI.GridTableScrollbar.SIZE, headerCellStyleGetter: o.headerCellStyleGetter, summaryCellStyleGetter: o.summaryCellStyleGetter, diff --git a/demo.html b/demo.html index 53decbadc..55b264445 100644 --- a/demo.html +++ b/demo.html @@ -5,24 +5,24 @@