diff --git a/bi.lessconfig.json b/bi.lessconfig.json index d4042b18d..a5f1d669f 100644 --- a/bi.lessconfig.json +++ b/bi.lessconfig.json @@ -15,7 +15,7 @@ "@color-bi-background-active-radio-content": "#2C60DB", "@color-bi-background-disabled-active-radio-content": "#D0D4DA", "@color-bi-background-disabled-active-radio-content-theme-dark": "#606479", - "@color-bi-background-disabled-active-checkbox-content": "#D0D4DA", + "@color-bi-background-disabled-active-checkbox-content": "#FFFFFF", "@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479", "@color-bi-background-tooltip-success": "#2E3A4D", "@color-bi-text-header-background": "#647185", diff --git a/dist/font/iconfont.eot b/dist/font/iconfont.eot index 075818a81..f5457bc8e 100644 Binary files a/dist/font/iconfont.eot and b/dist/font/iconfont.eot differ diff --git a/dist/font/iconfont.svg b/dist/font/iconfont.svg index dafa8bcf7..3bff3722b 100644 --- a/dist/font/iconfont.svg +++ b/dist/font/iconfont.svg @@ -14,6 +14,28 @@ /> + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/font/iconfont.ttf b/dist/font/iconfont.ttf index 71d5b388c..c19a5fc27 100644 Binary files a/dist/font/iconfont.ttf and b/dist/font/iconfont.ttf differ diff --git a/dist/font/iconfont.woff b/dist/font/iconfont.woff index cc6850fa7..f25ee6f70 100644 Binary files a/dist/font/iconfont.woff and b/dist/font/iconfont.woff differ diff --git a/dist/font/iconfont.woff2 b/dist/font/iconfont.woff2 index d80fd46c8..36c093a94 100644 Binary files a/dist/font/iconfont.woff2 and b/dist/font/iconfont.woff2 differ diff --git a/package.json b/package.json index 679b9d986..42955fcce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220329211439", + "version": "2.0.20220427103402", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index 4df7b392e..a9ba5c23c 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -33,11 +33,9 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { self.populate(newValue); }) : o.items; this.populate(items); - if (BI.isFunction(o.value)) { - this.__watch(o.value, function (context, newValue) { - self.setValue(newValue); - }) - } + o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) { + self.setValue(newValue); + }) : o.value; if (BI.isKey(o.value) || BI.isNotEmptyArray(o.value)) { this.setValue(o.value); } diff --git a/src/base/combination/group.virtual.js b/src/base/combination/group.virtual.js index 299cb5d8a..e816ab108 100644 --- a/src/base/combination/group.virtual.js +++ b/src/base/combination/group.virtual.js @@ -17,11 +17,9 @@ BI.VirtualGroup = BI.inherit(BI.Widget, { self.populate(newValue); }) : o.items; this.populate(items); - if (BI.isFunction(o.value)) { - this.__watch(o.value, function (context, newValue) { - self.setValue(newValue); - }) - } + o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) { + self.setValue(newValue); + }) : o.value; if (BI.isKey(o.value)) { this.setValue(o.value); } diff --git a/src/base/foundation/message.js b/src/base/foundation/message.js index 860449ab4..156297c9d 100644 --- a/src/base/foundation/message.js +++ b/src/base/foundation/message.js @@ -22,6 +22,7 @@ BI.Msg = function () { // BI.Msg.prompt(title, message, value, callback, min_width); }, toast: function (message, options, context) { + BI.isString(options) && (options = { level: options }) options = options || {}; context = context || BI.Widget._renderEngine.createElement("body"); var level = options.level || "common"; diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index 5ad4f064d..8e747d24f 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -185,7 +185,7 @@ BI.PopupView = BI.inherit(BI.Widget, { setDirection: function (direction, position) { var o = this.options; if (o.showArrow) { - var style, wrapperStyle, placeholderStyle; + var style = {}, wrapperStyle = {}, placeholderStyle = {}; var adjustXOffset = position.adjustXOffset || 0; var adjustYOffset = position.adjustYOffset || 0; var bodyBounds = BI.Widget._renderEngine.createElement("body").bounds(); diff --git a/src/base/pager/pager.js b/src/base/pager/pager.js index 5967271b2..64ea9a942 100644 --- a/src/base/pager/pager.js +++ b/src/base/pager/pager.js @@ -26,7 +26,6 @@ BI.Pager = BI.inherit(BI.Widget, { }, // 初始化当前页 groups: 0, // 连续显示分页数 jump: BI.emptyFn, // 分页的回调函数 - first: false, // 是否显示首页 last: false, // 是否显示尾页 prev: "上一页", @@ -37,7 +36,7 @@ BI.Pager = BI.inherit(BI.Widget, { return 1; }, hasPrev: BI.emptyFn, // pages不可用时有效 - hasNext: BI.emptyFn // pages不可用时有效 + hasNext: BI.emptyFn // pages不可用时有效 }); }, @@ -83,9 +82,11 @@ BI.Pager = BI.inherit(BI.Widget, { disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) }); } else { - view.push(BI.extend({ - disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) - }, prev)); + view.push({ + el: BI.extend({ + disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) + }, prev) + }); } } @@ -96,7 +97,7 @@ BI.Pager = BI.inherit(BI.Widget, { value: "first", disabled: !(dict.index > 1 && groups !== 0) }); - if (dict.index > 1 && groups !== 0) { + if (dict.index > 1 && groups !== 0 && groups !== pages - 1) { view.push({ type: "bi.label", cls: "page-ellipsis", @@ -110,6 +111,7 @@ BI.Pager = BI.inherit(BI.Widget, { dict.start = dict.index > 1 ? curr - dict.poor : 1; dict.end = dict.index > 1 ? (function () { var max = curr + (groups - dict.poor - 1); + return max > pages ? pages : max; }()) : groups; if (dict.end - dict.start < groups - 1) { // 最后一组状态 @@ -137,7 +139,7 @@ BI.Pager = BI.inherit(BI.Widget, { // 总页数大于连续分页数,且当前组最大页小于总页,输出尾页 if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (pages > groups && dict.end < pages && groups !== 0)) && last) { - if (pages > groups && dict.end < pages && groups !== 0) { + if (pages > groups && dict.end < pages && groups !== 0 && groups !== pages - 1) { view.push({ type: "bi.label", cls: "page-ellipsis", @@ -157,29 +159,36 @@ BI.Pager = BI.inherit(BI.Widget, { view.push((function () { if (BI.isKey(next)) { if (pages === false) { - return {text: next, value: "next", disabled: o.hasNext(curr) === false}; + return { text: next, value: "next", disabled: o.hasNext(curr) === false }; } + return (dict.flow && curr === pages) ? - {text: next, value: "next", disabled: true} + { text: next, value: "next", disabled: true } : - {text: next, value: "next", disabled: !(curr !== pages && next || dict.flow)}; + { text: next, value: "next", disabled: !(curr !== pages && next || dict.flow) }; } - return BI.extend({ - disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow) - }, next); + return { + el: BI.extend({ + disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow) + }, next) + }; }())); } this.button_group = BI.createWidget({ type: "bi.button_group", element: this, - items: BI.createItems(view, { - cls: "bi-list-item-select bi-border-radius", - height: 23, - hgap: 10, - stopPropagation: true + items: BI.map(view, function (idx, v) { + v = BI.extend({ + cls: "bi-list-item-select bi-border-radius", + height: 23, + hgap: v.el ? 0 : 10, + stopPropagation: true + }, BI.stripEL(v)); + + return BI.formatEL(v); }), behaviors: o.behaviors, layouts: o.layouts @@ -233,6 +242,7 @@ BI.Pager = BI.inherit(BI.Widget, { v || (v = 1); var o = this.options; var pages = this.options.pages; + return pages === false ? o.hasPrev(v) : v > 1; }, @@ -240,6 +250,7 @@ BI.Pager = BI.inherit(BI.Widget, { v || (v = 1); var o = this.options; var pages = this.options.pages; + return pages === false ? o.hasNext(v) : v < pages; }, @@ -268,7 +279,7 @@ BI.Pager = BI.inherit(BI.Widget, { return BI.MIN; case "last": return BI.MAX; - default : + default: return val; } }, diff --git a/src/case/button/node/node.arrow.js b/src/case/button/node/node.arrow.js index 6fc690d7b..052858e52 100644 --- a/src/case/button/node/node.arrow.js +++ b/src/case/button/node/node.arrow.js @@ -22,12 +22,6 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, { this.checkbox = BI.createWidget({ type: "bi.arrow_group_node_checkbox" }); - this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { - if (type === BI.Events.CLICK) { - self.setSelected(self.isSelected()); - } - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); return { type: "bi.vertical_adapt", columnSize: [o.iconWrapperWidth || o.height, "fill"], diff --git a/src/case/button/switch.js b/src/case/button/switch.js index 0c7c199fb..ba4de99d2 100644 --- a/src/case/button/switch.js +++ b/src/case/button/switch.js @@ -36,14 +36,14 @@ BI.Switch = BI.inherit(BI.BasicButton, { width: 12, height: 12, top: tgap, - left: this.options.selected ? 28 : 4 + left: o.selected ? 28 : 4 }, { type: "bi.label", text: BI.i18nText("BI-Basic_Simple_Open"), cls: "content-tip", left: 8, top: tgap - 2, - invisible: !o.showTip, + invisible: !(o.showTip && o.selected), ref: function (ref) { self.openTip = ref; } @@ -53,7 +53,7 @@ BI.Switch = BI.inherit(BI.BasicButton, { cls: "content-tip", right: 8, top: tgap - 2, - invisible: !o.showTip, + invisible: !(o.showTip && !o.selected), ref: function (ref) { self.closeTip = ref; } diff --git a/src/case/combo/bubblecombo/combo.bubble.js b/src/case/combo/bubblecombo/combo.bubble.js index e143efab0..2709295d9 100644 --- a/src/case/combo/bubblecombo/combo.bubble.js +++ b/src/case/combo/bubblecombo/combo.bubble.js @@ -99,6 +99,14 @@ BI.BubbleCombo = BI.inherit(BI.Widget, { isViewVisible: function () { return this.combo.isViewVisible(); + }, + + adjustWidth: function () { + this.combo.adjustWidth(); + }, + + adjustHeight: function () { + this.combo.adjustHeight(); } }); diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 12f71e383..12037b9a9 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -93,10 +93,23 @@ BI.SelectList = BI.inherit(BI.Widget, { var notSelectLength = this.getAllLeaves().length - selectLength; var hasNext = this.list.hasNext(); var isAlreadyAllSelected = this.toolbar.isSelected(); - var isHalf = selectLength > 0 && (notSelectLength > 0 || (!isAlreadyAllSelected && hasNext)); - isHalf = isHalf || (notSelectLength > 0 && hasNext && isAlreadyAllSelected); + var isHalf = selectLength > 0 && notSelectLength > 0; + var allSelected = isAlreadyAllSelected; + + if (this.isAllSelected() === false) { + hasNext && (isHalf = selectLength > 0); + if (!isAlreadyAllSelected && notSelectLength === 0 && !hasNext) { + allSelected = true; + } + } else { + hasNext && (isHalf = notSelectLength > 0); + if (!isAlreadyAllSelected && notSelectLength === 0) { + allSelected = true; + } + } + this.toolbar.setHalfSelected(isHalf); - !isHalf && this.toolbar.setSelected(selectLength > 0 && notSelectLength <= 0 && (!hasNext || isAlreadyAllSelected)); + !isHalf && this.toolbar.setSelected(allSelected); }, setAllSelected: function (v) { diff --git a/src/case/ztree/0.treeview.js b/src/case/ztree/0.treeview.js index 79ffd5bb6..2ee02010f 100644 --- a/src/case/ztree/0.treeview.js +++ b/src/case/ztree/0.treeview.js @@ -347,33 +347,33 @@ BI.TreeView = BI.inherit(BI.Pane, { _dealWidthNodes: function (nodes) { var self = this, o = this.options; var ns = BI.Tree.arrayFormat(nodes); - BI.each(ns, function (i, n) { - n.isParent = n.isParent || n.parent; + return BI.map(ns, function (i, n) { + var newNode = BI.extend({}, n); + newNode.isParent = newNode.isParent || newNode.parent; // n.value = BI.isUndefined(n.value) ? n.text : n.value; // n.text = BI.isUndefined(n.text) ? n.value : n.text; // if (n.text === null) { // n.text = ""; // } - if (BI.isNull(n.title)) { - n.title = n.text; + if (BI.isNull(newNode.title)) { + newNode.title = newNode.text; } - if (n.disabled) { - n.title = n.warningTitle || n.title; + if (newNode.disabled) { + newNode.title = newNode.warningTitle || newNode.title; } var text = BI.createWidget(BI.extend({ cls: "tree-node-text", - css: { - display: "inline" - }, + tagName: "span", whiteSpace: "nowrap", root: true, keyword: o.paras.keyword - }, n, { - type: "bi.text" + }, newNode, { + type: "bi.text", + text: BI.replaceAll(newNode.text, "\n", " ") })); var fragment = BI.Widget._renderEngine.createElement("
"); fragment.append(text.element[0]); - n.text = fragment.html(); + newNode.text = fragment.html(); // // 处理标红 // if (BI.isNotNull(n.text)) { // if (BI.isKey(o.paras.keyword)) { @@ -382,8 +382,8 @@ BI.TreeView = BI.inherit(BI.Pane, { // n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); // } // } + return newNode; }); - return nodes; }, _loadMore: function () { diff --git a/src/core/2.base.js b/src/core/2.base.js index 4a2a2df68..ba2d9ec77 100644 --- a/src/core/2.base.js +++ b/src/core/2.base.js @@ -281,13 +281,13 @@ var i; if (BI.isArray(obj)) { for (i = 0; i < obj.length; i++) { - if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && BI.contains(target, obj[i]))) { + if ((isFunction && (target === obj[i] || target.apply(context, [i, obj[i]]) === true)) || (!isFunction && BI.contains(target, obj[i]))) { obj.splice(i--, 1); } } } else { BI.each(obj, function (i, v) { - if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && BI.contains(target, obj[i]))) { + if ((isFunction && (target === obj[i] || target.apply(context, [i, obj[i]]) === true)) || (!isFunction && BI.contains(target, obj[i]))) { delete obj[i]; } }); @@ -735,20 +735,6 @@ BI[name] = _apply(name); }); _.extend(BI, { - getTime: function () { - if (_global.performance && _global.performance.now) { - return _global.performance.now(); - } - if (_global.performance && _global.performance.webkitNow) { - return _global.performance.webkitNow(); - } - if (Date.now) { - return Date.now(); - } - return BI.getDate().getTime(); - - - }, parseInt: function (number) { var radix = 10; diff --git a/src/core/controller/controller.broadcast.js b/src/core/controller/controller.broadcast.js index 89b2f0c35..71d7330c7 100644 --- a/src/core/controller/controller.broadcast.js +++ b/src/core/controller/controller.broadcast.js @@ -30,10 +30,9 @@ BI.BroadcastController = BI.inherit(BI.Controller, { remove: function (name, fn) { var self = this; if (fn) { - BI.remove(this._broadcasts[name], function (idx) { - return self._broadcasts[name].indexOf(fn) === idx; + BI.remove(this._broadcasts[name], function (index, cb) { + return fn === cb; }); - this._broadcasts[name].remove(fn); if (this._broadcasts[name].length === 0) { delete this._broadcasts[name]; } diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index 52976e103..05757959d 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -628,20 +628,20 @@ return pos; default : if (BI.DOM.isBottomSpaceLarger(combo)) { - pos = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight); + top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top; firstDir = "bottom"; } else { - pos = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight); + top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top; firstDir = "top"; } if (leftRight[0] === "right") { - left = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight).left; - pos.left = left; + pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight); + pos.top = top; pos.dir = firstDir + "," + pos.dir; return pos; } - left = BI.DOM.getRightAlignPosition(combo, popup, extraWidth).left; - pos.left = left; + pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth); + pos.top = top; pos.dir = firstDir + "," + pos.dir; return pos; } diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index 7b87a2d1c..1228e7e59 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -52,7 +52,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); - var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width; + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; if (o.columnSize.length > 0) { if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) { columnSize = null; @@ -81,6 +81,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { } if (columnSize === "fill") { w.element.addClass("f-f"); + w.element.css({ minWidth: 0 }); } w.element.addClass("c-e"); if (i === 0) { diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index 4f9ee1119..40f252ed2 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -51,7 +51,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexVerticalLayout.superclass._addElement.apply(this, arguments); - var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height >= 1 ? null : item.height; + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; if (o.rowSize.length > 0) { if (item.height >= 1 && o.rowSize[i] >= 1 && o.rowSize[i] !== item.height) { rowSize = null; @@ -80,6 +80,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { } if (rowSize === "fill") { w.element.addClass("f-f"); + w.element.css({ minHeight: 0 }); } w.element.addClass("c-e"); if (i === 0) { diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js index d159d8890..8c803abaa 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -48,7 +48,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperHorizontalLayout.superclass._addElement.apply(this, arguments); - var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width; + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; if (o.columnSize.length > 0) { if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) { columnSize = null; diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js index 0f1c9b166..33609e717 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -48,7 +48,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { _addElement: function (i, item) { var o = this.options; var w = BI.FlexWrapperVerticalLayout.superclass._addElement.apply(this, arguments); - var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height >= 1 ? null : item.height; + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; if (o.rowSize.length > 0) { if (item.height >= 1 && o.rowSize[i] >= 1 && o.rowSize[i] !== item.height) { rowSize = null; diff --git a/src/core/wrapper/layout/sticky/sticky.horizontal.js b/src/core/wrapper/layout/sticky/sticky.horizontal.js index f178afd6b..c5b644542 100644 --- a/src/core/wrapper/layout/sticky/sticky.horizontal.js +++ b/src/core/wrapper/layout/sticky/sticky.horizontal.js @@ -13,7 +13,7 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, { _addElement: function (i, item) { var o = this.options; var w = BI.HorizontalStickyLayout.superclass._addElement.apply(this, arguments); - var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width; + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width; if (o.columnSize.length > 0) { if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) { columnSize = null; diff --git a/src/core/wrapper/layout/sticky/sticky.vertical.js b/src/core/wrapper/layout/sticky/sticky.vertical.js index d99b8828e..a5ba3d837 100644 --- a/src/core/wrapper/layout/sticky/sticky.vertical.js +++ b/src/core/wrapper/layout/sticky/sticky.vertical.js @@ -13,7 +13,7 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, { _addElement: function (i, item) { var o = this.options; var w = BI.VerticalStickyLayout.superclass._addElement.apply(this, arguments); - var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height >= 1 ? null : item.height; + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height; if (o.rowSize.length > 0) { if (item.height >= 1 && o.rowSize[i] >= 1 && o.rowSize[i] !== item.height) { rowSize = null; diff --git a/src/less/base/single/button/button.half.less b/src/less/base/single/button/button.half.less index 79669689e..3f8c1377f 100644 --- a/src/less/base/single/button/button.half.less +++ b/src/less/base/single/button/button.half.less @@ -3,6 +3,7 @@ .bi-half-button { .border-radius(2px); box-sizing: border-box; + &:after { position: absolute; left: 2px; @@ -12,4 +13,10 @@ background-color: @color-bi-background-half-button-content; content: ''; } + + &.disabled { + &:after { + background-color: @color-bi-background-disabled-half-button-content; + } + } } diff --git a/src/less/base/tree/tree.expander.less b/src/less/base/tree/tree.expander.less index b2e5b0c85..67aac48d3 100644 --- a/src/less/base/tree/tree.expander.less +++ b/src/less/base/tree/tree.expander.less @@ -12,7 +12,7 @@ .bi-tree-expander-popup.line.solid:before { .imagePath(@icon-tree-solid-vertical-line-1, 0, 0, repeat-y); width: 24px; - left:4px; + left: 8px; } .bi-theme-dark { @@ -23,6 +23,6 @@ .bi-tree-expander-popup.line.solid:before { .imagePath(@icon-tree-solid-vertical-line-1-theme-dark, 0, 0, repeat-y); width: 24px; - left:4px; + left: 8px; } } diff --git a/src/less/base/view/popupview.less b/src/less/base/view/popupview.less index 37c421152..c9aeb1333 100644 --- a/src/less/base/view/popupview.less +++ b/src/less/base/view/popupview.less @@ -107,6 +107,7 @@ transform: translateX(0px) rotate(-135deg); transform-origin: center center; .box-shadow(3px 3px 10px 0,rgba(0, 0, 0, 6%)); + .border-radius(2px); } } } diff --git a/src/less/lib/theme.less b/src/less/lib/theme.less index d83ef3789..9fddef950 100644 --- a/src/less/lib/theme.less +++ b/src/less/lib/theme.less @@ -195,6 +195,7 @@ @color-bi-split-disabled-segment: @color-bi-border-disabled; // 半选 @color-bi-background-half-button-content: @color-bi-background-highlight; +@color-bi-background-disabled-half-button-content: @color-bi-background-light-disabled; // items @color-bi-text-active-single-select-icon-text-item: @color-bi-text-highlight; // editor diff --git a/src/router/router.js b/src/router/router.js index f82516d73..77dfd7d20 100644 --- a/src/router/router.js +++ b/src/router/router.js @@ -3126,8 +3126,8 @@ BI.RouterWidget = BI.inherit(BI.Widget, { init: function () { this.$router = this._router = BI.Router.$router = $router = new VueRouter({ - routes: this.options.routes, mode: this.options.mode, + routes: this.options.routes, base: this.options.base }); this.$router.beforeEach(function (to, from, next) { @@ -3203,4 +3203,3 @@ return VueRouter; }))); - diff --git a/src/widget/downlist/item.downlistgroup.js b/src/widget/downlist/item.downlistgroup.js index d89132f47..31492b78b 100644 --- a/src/widget/downlist/item.downlistgroup.js +++ b/src/widget/downlist/item.downlistgroup.js @@ -28,6 +28,7 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, { type: "bi.icon_button", cls: o.iconCls1, width: 36, + height: o.height, disableSelected: true, selected: this._digest(o.value) }); diff --git a/src/widget/downlist/popup.downlist.js b/src/widget/downlist/popup.downlist.js index 5abb8fe96..35d395334 100644 --- a/src/widget/downlist/popup.downlist.js +++ b/src/widget/downlist/popup.downlist.js @@ -26,8 +26,8 @@ BI.DownListPopup = BI.inherit(BI.Pane, { this.singleValues = []; this.childValueMap = {}; this.fatherValueMap = {}; - this.items = BI.deepClone(this.options.items); - var self = this, o = this.options, children = this._createChildren(this.items); + this.items = []; + var self = this, o = this.options, children = this._createPopupItems(o.items); this.popup = BI.createWidget({ type: "bi.button_tree", items: BI.createItems(children, @@ -75,7 +75,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { }); }, - _createChildren: function (items) { + _createPopupItems: function (items) { var self = this, result = []; // 不能修改populate进来的item的引用 BI.each(items, function (i, it) { @@ -84,8 +84,11 @@ BI.DownListPopup = BI.inherit(BI.Pane, { items: [] }; - BI.each(it, function (i, item) { - if (BI.isNotEmptyArray(item.children) && !BI.isEmpty(item.el)) { + var storeItem = []; + + BI.each(it, function (i, sourceItem) { + var item = BI.extend({}, sourceItem); + if (BI.isNotEmptyArray(sourceItem.children) && !BI.isEmpty(sourceItem.el)) { item.type = "bi.combo_group"; // popup未初始化返回的是options中的value, 在经过buttontree的getValue concat之后,无法区分值来自options // 还是item自身, 这边控制defaultInit为true来避免这个问题 @@ -93,12 +96,13 @@ BI.DownListPopup = BI.inherit(BI.Pane, { item.cls = "down-list-group"; item.trigger = "hover"; item.isNeedAdjustWidth = false; - item.el.title = item.el.title || item.el.text; + item.el = sourceItem.el; + item.el.title = sourceItem.el.title || sourceItem.el.text; item.el.type = "bi.down_list_group_item"; item.el.logic = { dynamic: true }; - item.el.height = item.el.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT; + item.el.height = sourceItem.el.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT; item.el.iconCls2 = self.constants.nextIcon; item.popup = { lgap: 1, @@ -113,30 +117,10 @@ BI.DownListPopup = BI.inherit(BI.Pane, { innerVgap: 5, maxHeight: 378 }; - item.el.childValues = []; - item.items = item.children; - BI.each(item.children, function (i, child) { - var fatherValue = BI.deepClone(item.el.value); - var childValue = BI.deepClone(child.value); - self.singleValues.push(child.value); - child.type = child.type || "bi.down_list_item"; - child.extraCls = " child-down-list-item"; - child.title = child.title || child.text; - child.textRgap = 10; - child.isNeedAdjustWidth = false; - child.logic = { - dynamic: true - }; - child.father = fatherValue; - child.childValue = child.value; - self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; - self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; - child.value = self._createChildValue(fatherValue, childValue); - item.el.childValues.push(child.value); - }); + self._createChildren(item, sourceItem); } else { - item.type = item.type || "bi.down_list_item"; - item.title = item.title || item.text; + item.type = sourceItem.type || "bi.down_list_item"; + item.title = sourceItem.title || sourceItem.text; item.textRgap = 10; item.isNeedAdjustWidth = false; item.logic = { @@ -146,6 +130,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { var el_done = {}; el_done.el = item; item_done.items.push(el_done); + storeItem.push(item); }); if (self._isGroup(item_done.items)) { BI.each(item_done.items, function (i, item) { @@ -154,6 +139,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { } result.push(item_done); + self.items.push(storeItem); if (self._needSpliter(i, items.length)) { var spliter_container = BI.createWidget({ type: "bi.vertical", @@ -176,6 +162,33 @@ BI.DownListPopup = BI.inherit(BI.Pane, { return result; }, + _createChildren: function (targetItem, sourceItem) { + var self = this; + targetItem.el.childValues = []; + targetItem.items = targetItem.children = []; + BI.each(sourceItem.children, function (i, child) { + var item = BI.extend({}, child); + var fatherValue = BI.deepClone(targetItem.el.value); + var childValue = BI.deepClone(item.value); + self.singleValues.push(item.value); + item.type = item.type || "bi.down_list_item"; + item.extraCls = " child-down-list-item"; + item.title = item.title || item.text; + item.textRgap = 10; + item.isNeedAdjustWidth = false; + item.logic = { + dynamic: true + }; + item.father = fatherValue; + item.childValue = item.value; + self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; + self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; + item.value = self._createChildValue(fatherValue, childValue); + targetItem.el.childValues.push(item.value); + targetItem.items.push(item); + }); + }, + _isGroup: function (i) { return i.length > 1; }, @@ -239,11 +252,11 @@ BI.DownListPopup = BI.inherit(BI.Pane, { populate: function (items) { BI.DownListPopup.superclass.populate.apply(this, arguments); - this.items = BI.deepClone(items); + this.items = []; this.childValueMap = {}; this.fatherValueMap = {}; this.singleValues = []; - var children = this._createChildren(this.items); + var children = this._createPopupItems(items); var popupItem = BI.createItems(children, {}, { adjustLength: -2 diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index af9a14614..14f8cb5f4 100644 --- a/src/widget/editor/editor.search.js +++ b/src/widget/editor/editor.search.js @@ -10,7 +10,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, { errorText: "", watermark: BI.i18nText("BI-Basic_Search"), validationChecker: BI.emptyFn, - quitChecker: BI.emptyFn + quitChecker: BI.emptyFn, + value: "" }); }, _init: function () { @@ -32,7 +33,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, { this.clear = BI.createWidget({ type: "bi.icon_button", stopEvent: true, - cls: "close-font" + cls: "close-font", + invisible: BI.isKey(o.value) }); this.clear.on(BI.IconButton.EVENT_CHANGE, function () { self.setValue(""); @@ -123,8 +125,6 @@ BI.SearchEditor = BI.inherit(BI.Widget, { this.editor.on(BI.Editor.EVENT_STOP, function () { self.fireEvent(BI.SearchEditor.EVENT_STOP); }); - - this.clear.invisible(); }, _checkClear: function () { @@ -214,4 +214,4 @@ BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER"; BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE"; BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY"; -BI.shortcut("bi.search_editor", BI.SearchEditor); \ No newline at end of file +BI.shortcut("bi.search_editor", BI.SearchEditor); diff --git a/src/widget/multilayerdownlist/popup.downlist.js b/src/widget/multilayerdownlist/popup.downlist.js index c18351220..fa222005d 100644 --- a/src/widget/multilayerdownlist/popup.downlist.js +++ b/src/widget/multilayerdownlist/popup.downlist.js @@ -26,6 +26,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { this.singleValues = []; this.childValueMap = {}; this.fatherValueMap = {}; + this.items = []; var self = this, o = this.options, children = this._createPopupItems(o.items); this.popup = BI.createWidget({ type: "bi.button_tree", @@ -83,19 +84,22 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { type: "bi.down_list_group", items: [] }; + var storeItem = []; - BI.each(it, function (i, item) { - if (BI.isNotEmptyArray(item.children) && !BI.isEmpty(item.el)) { + BI.each(it, function (i, sourceItem) { + var item = BI.extend({}, sourceItem); + if (BI.isNotEmptyArray(sourceItem.children) && !BI.isEmpty(sourceItem.el)) { item.type = "bi.combo_group"; item.cls = "down-list-group"; item.trigger = "hover"; item.isNeedAdjustWidth = false; - item.el.title = item.el.title || item.el.text; + item.el = sourceItem.el; + item.el.title = sourceItem.el.title || sourceItem.el.text; item.el.type = "bi.down_list_group_item"; item.el.logic = { dynamic: true }; - item.el.height = item.el.height || self.constants.height; + item.el.height = sourceItem.el.height || self.constants.height; item.el.iconCls2 = self.constants.nextIcon; item.popup = { lgap: 1, @@ -110,10 +114,10 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { innerVgap: 5, maxHeight: 378, }; - self._createChildren(item); + self._createChildren(item, sourceItem); } else { - item.type = item.type || "bi.down_list_item"; - item.title = item.title || item.text; + item.type = sourceItem.type || "bi.down_list_item"; + item.title = sourceItem.title || sourceItem.text; item.textRgap = 10; item.isNeedAdjustWidth = false; item.logic = { @@ -123,6 +127,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { var el_done = {}; el_done.el = item; item_done.items.push(el_done); + storeItem.push(item); }); if (self._isGroup(item_done.items)) { BI.each(item_done.items, function (i, item) { @@ -131,6 +136,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { } result.push(item_done); + self.items.push(storeItem); if (self._needSpliter(i, items.length)) { var spliter_container = BI.createWidget({ type: "bi.vertical", @@ -152,34 +158,35 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { return result; }, - _createChildren: function (item) { + _createChildren: function (targetItem, sourceItem) { var self = this; - this._formatEL(item).el.childValues = []; - item.items = item.children; - BI.each(item.children, function (i, child) { - child = child.el ? BI.extend(child.el, {children: child.children}) : child; - var fatherValue = BI.deepClone(self._formatEL(item).el.value); - var childValue = BI.deepClone(child.value); - self.singleValues.push(child.value); - child.type = child.type || "bi.down_list_item"; - child.extraCls = " child-down-list-item"; - child.title = child.title || child.text; - child.textRgap = 10; - child.isNeedAdjustWidth = false; - child.logic = { + this._formatEL(targetItem).el.childValues = []; + targetItem.items = targetItem.children = []; + BI.each(sourceItem.children, function (i, child) { + var item = child.el ? BI.extend({}, child.el, {children: child.children}) : BI.extend({}, child); + var fatherValue = BI.deepClone(self._formatEL(targetItem).el.value); + var childValue = BI.deepClone(item.value); + self.singleValues.push(item.value); + item.type = item.type || "bi.down_list_item"; + item.extraCls = " child-down-list-item"; + item.title = item.title || item.text; + item.textRgap = 10; + item.isNeedAdjustWidth = false; + item.logic = { dynamic: true }; - child.father = fatherValue; + item.father = fatherValue; self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; - child.value = self._createChildValue(fatherValue, childValue); - self._formatEL(item).el.childValues.push(child.value); + item.value = self._createChildValue(fatherValue, childValue); + self._formatEL(targetItem).el.childValues.push(item.value); if (BI.isNotEmptyArray(child.children)) { - child.type = "bi.down_list_group_item"; - child.iconCls2 = self.constants.nextIcon; - child.height = child.height || self.constants.height; - self._createChildren(child); + item.type = "bi.down_list_group_item"; + item.iconCls2 = self.constants.nextIcon; + item.height = child.height || self.constants.height; + self._createChildren(item, child); } + targetItem.items.push(item); }); }, @@ -228,7 +235,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { _checkValues: function (values) { var self = this, o = this.options; var value = []; - BI.each(o.items, function (idx, itemGroup) { + BI.each(this.items, function (idx, itemGroup) { BI.each(itemGroup, function (id, item) { if(BI.isNotNull(item.children)) { var childValues = getChildrenValue(item); @@ -277,6 +284,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, { self.childValueMap = {}; self.fatherValueMap = {}; self.singleValues = []; + this.items = []; var children = self._createPopupItems(items); var popupItem = BI.createItems(children, {}, { diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 09c06b6a3..254aa0340 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -17,14 +17,15 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _init: function () { - var self = this; var o = this.options; + var self = this; + var o = this.options; BI.MultiSelectCombo.superclass._init.apply(this, arguments); var assertShowValue = function () { if (BI.isKey(self._startValue)) { if (self.storeValue.type === BI.Selection.All) { BI.remove(self.storeValue.value, self._startValue); self.storeValue.assist = self.storeValue.assist || []; - self.storeValue.assist.pushDistinct(self._startValue); + BI.pushDistinct(self.storeValue.assist, self._startValue); } else { BI.pushDistinct(self.storeValue.value, self._startValue); BI.remove(self.storeValue.assist, self._startValue); @@ -280,7 +281,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _itemsCreator4Trigger: function (op, callback) { - var self = this; var o = this.options; + var self = this; + var o = this.options; o.itemsCreator(op, function (res) { if (op.times === 1 && BI.isNotNull(op.keywords)) { // 预防trigger内部把当前的storeValue改掉 @@ -311,7 +313,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _joinKeywords: function (keywords, callback) { - var self = this; var o = this.options; + var self = this; + var o = this.options; this._assertValue(this.storeValue); this.requesting = true; o.itemsCreator({ @@ -322,7 +325,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { digest(values); }); - function digest (items) { + function digest(items) { var selectedMap = self._makeMap(items); BI.each(keywords, function (i, val) { if (BI.isNotNull(selectedMap[val])) { @@ -334,7 +337,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _joinAll: function (res, callback) { - var self = this; var o = this.options; + var self = this; + var o = this.options; this._assertValue(res); this.requesting = true; if (this.storeValue.type === res.type) { @@ -385,11 +389,12 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _adjust: function (callback) { - var self = this; var o = this.options; + var self = this; + var o = this.options; adjust(); callback(); - function adjust () { + function adjust() { if (self.wants2Quit === true) { self._dataChange && self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); self.wants2Quit = false; @@ -399,7 +404,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }, _join: function (res, callback) { - var self = this; var o = this.options; + var self = this; + var o = this.options; this._assertValue(res); this._assertValue(this.storeValue); if (this.storeValue.type === res.type) { diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index b4fe04154..06138cf4b 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -23,7 +23,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { if (self.storeValue.type === BI.Selection.All) { BI.remove(self.storeValue.value, self._startValue); self.storeValue.assist = self.storeValue.assist || []; - self.storeValue.assist.pushDistinct(self._startValue); + BI.pushDistinct(self.storeValue.assist, self._startValue); } else { BI.pushDistinct(self.storeValue.value, self._startValue); BI.remove(self.storeValue.assist, self._startValue); @@ -461,11 +461,11 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { this.combo.populate.apply(this.combo, arguments); }, - showView:function (){ + showView: function () { this.combo.showView(); }, - hideView:function (){ + hideView: function () { this.combo.hideView(); }, diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 0cedaf020..b5906f856 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -21,10 +21,10 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { BI.MultiSelectInsertCombo.superclass._init.apply(this, arguments); var assertShowValue = function () { if (BI.isKey(self._startValue)) { - if(self.storeValue.type === BI.Selection.All) { + if (self.storeValue.type === BI.Selection.All) { BI.remove(self.storeValue.value, self._startValue); self.storeValue.assist = self.storeValue.assist || []; - self.storeValue.assist.pushDistinct(self._startValue); + BI.pushDistinct(self.storeValue.assist, self._startValue); } else { BI.pushDistinct(self.storeValue.value, self._startValue); BI.remove(self.storeValue.assist, self._startValue); @@ -282,7 +282,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); }, - _itemsCreator4Trigger: function(op, callback) { + _itemsCreator4Trigger: function (op, callback) { var self = this, o = this.options; o.itemsCreator(op, function (res) { if (op.times === 1 && BI.isNotNull(op.keywords)) { @@ -313,7 +313,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); }, - _stopEditing: function() { + _stopEditing: function () { this.trigger.stopEditing(); this.numberCounter.hideView(); }, @@ -340,7 +340,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { digest(); - function digest () { + function digest() { BI.each(keywords, function (i, val) { self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val); }); @@ -403,7 +403,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { var self = this, o = this.options; adjust(); callback(); - function adjust () { + + function adjust() { if (self.wants2Quit === true) { self._dataChange && self.fireEvent(BI.MultiSelectInsertCombo.EVENT_CONFIRM); self.wants2Quit = false; @@ -450,11 +451,11 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.combo.populate.apply(this.combo, arguments); }, - showView:function (){ + showView: function () { this.combo.showView(); }, - hideView:function (){ + hideView: function () { this.combo.hideView(); }, diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 39099bbde..de4f9eb35 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -23,7 +23,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { if (self.storeValue.type === BI.Selection.All) { BI.remove(self.storeValue.value, self._startValue); self.storeValue.assist = self.storeValue.assist || []; - self.storeValue.assist.pushDistinct(self._startValue); + BI.pushDistinct(self.storeValue.assist, self._startValue); } else { BI.pushDistinct(self.storeValue.value, self._startValue); BI.remove(self.storeValue.assist, self._startValue); @@ -279,7 +279,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { }); }, - _itemsCreator4Trigger: function(op, callback) { + _itemsCreator4Trigger: function (op, callback) { var self = this, o = this.options; o.itemsCreator(op, function (res) { if (op.times === 1 && BI.isNotNull(op.keywords)) { @@ -310,7 +310,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { }); }, - _stopEditing: function() { + _stopEditing: function () { this.trigger.stopEditing(); this.numberCounter.hideView(); }, @@ -337,7 +337,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { digest(); - function digest () { + function digest() { BI.each(keywords, function (i, val) { self.storeValue.type === BI.Selection.Multi ? BI.pushDistinct(self.storeValue.value, val) : BI.remove(self.storeValue.value, val); }); @@ -400,7 +400,8 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { var self = this, o = this.options; adjust(); callback(); - function adjust () { + + function adjust() { if (self.wants2Quit === true) { self._dataChange && self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM); self.wants2Quit = false; @@ -446,11 +447,11 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { this.combo.populate.apply(this.combo, arguments); }, - showView:function (){ + showView: function () { this.combo.showView(); }, - hideView:function (){ + hideView: function () { this.combo.hideView(); }, diff --git a/src/widget/singleselect/singleselect.combo.js b/src/widget/singleselect/singleselect.combo.js index fb873438f..fae620c93 100644 --- a/src/widget/singleselect/singleselect.combo.js +++ b/src/widget/singleselect/singleselect.combo.js @@ -10,6 +10,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { baseCls: "bi-single-select-combo", allowNoSelect: false, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, valueFormatter: BI.emptyFn, height: 24, allowEdit: true @@ -107,6 +108,7 @@ BI.SingleSelectCombo = BI.inherit(BI.Single, { } }], itemsCreator: o.itemsCreator, + itemWrapper: o.itemWrapper, valueFormatter: o.valueFormatter, onLoaded: function () { BI.nextTick(function () { diff --git a/src/widget/singleselect/singleselect.insert.combo.js b/src/widget/singleselect/singleselect.insert.combo.js index b8b21cd09..46754e1dc 100644 --- a/src/widget/singleselect/singleselect.insert.combo.js +++ b/src/widget/singleselect/singleselect.insert.combo.js @@ -10,6 +10,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { baseCls: "bi-single-select-combo", allowNoSelect: false, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, valueFormatter: BI.emptyFn, height: 24, allowEdit: true, @@ -118,6 +119,7 @@ BI.SingleSelectInsertCombo = BI.inherit(BI.Single, { } }], itemsCreator: o.itemsCreator, + itemWrapper: o.itemWrapper, valueFormatter: o.valueFormatter, onLoaded: function () { BI.nextTick(function () { diff --git a/src/widget/singleselect/singleselect.loader.js b/src/widget/singleselect/singleselect.loader.js index 1f27b6425..645bdad66 100644 --- a/src/widget/singleselect/singleselect.loader.js +++ b/src/widget/singleselect/singleselect.loader.js @@ -22,6 +22,7 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { allowNoSelect: false, valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, onLoaded: BI.emptyFn }); }, @@ -69,7 +70,12 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { if (op.times === 1 && !BI.isUndefined(self.storeValue)) { var json = BI.map([self.storeValue], function (i, v) { var txt = opts.valueFormatter(v) || v; - return { + return opts.itemWrapper({ + text: txt, + value: v, + title: txt, + selected: true + }) || { text: txt, value: v, title: txt, @@ -117,7 +123,7 @@ BI.SingleSelectLoader = BI.inherit(BI.Widget, { height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, selected: false, iconWrapperWidth: 26, - hgap: o.allowNoSelect ? 10 : 0, + textHgap: o.allowNoSelect ? 10 : 0, title: item.title || item.text }, item); }); diff --git a/src/widget/singleselect/singleselect.popup.view.js b/src/widget/singleselect/singleselect.popup.view.js index 4e33c004f..ffa8766bd 100644 --- a/src/widget/singleselect/singleselect.popup.view.js +++ b/src/widget/singleselect/singleselect.popup.view.js @@ -14,6 +14,7 @@ BI.SingleSelectPopupView = BI.inherit(BI.Widget, { maxHeight: 400, valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, onLoaded: BI.emptyFn }); }, @@ -26,6 +27,7 @@ BI.SingleSelectPopupView = BI.inherit(BI.Widget, { type: "bi.single_select_loader", allowNoSelect: opts.allowNoSelect, itemsCreator: opts.itemsCreator, + itemWrapper: opts.itemWrapper, valueFormatter: opts.valueFormatter, onLoaded: opts.onLoaded, value: opts.value diff --git a/src/widget/singleselect/singleselectlist.insert.js b/src/widget/singleselect/singleselectlist.insert.js index db1722abc..f9bce32e6 100644 --- a/src/widget/singleselect/singleselectlist.insert.js +++ b/src/widget/singleselect/singleselectlist.insert.js @@ -9,6 +9,7 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, { baseCls: "bi-multi-select-insert-list", allowNoSelect: false, itemsCreator: BI.emptyFn, + itemWrapper: BI.emptyFn, valueFormatter: BI.emptyFn, searcherHeight: 24, }); @@ -30,6 +31,7 @@ BI.SingleSelectInsertList = BI.inherit(BI.Single, { cls: "popup-single-select-list bi-border-left bi-border-right bi-border-bottom", itemsCreator: o.itemsCreator, valueFormatter: o.valueFormatter, + itemWrapper: o.itemWrapper, logic: { dynamic: true }, diff --git a/typescript/base/combination/combo.ts b/typescript/base/combination/combo.ts index 249e7e6f2..c7d511a2b 100644 --- a/typescript/base/combination/combo.ts +++ b/typescript/base/combination/combo.ts @@ -59,6 +59,8 @@ export declare class Combo extends Widget { getPopupPosition(): any; + adjustWidth(e?:MouseEvent): void; + adjustHeight(e?: MouseEvent): void; toggle(): void; diff --git a/typescript/base/foundation/message.ts b/typescript/base/foundation/message.ts index ce7d54c3a..63790d1cb 100644 --- a/typescript/base/foundation/message.ts +++ b/typescript/base/foundation/message.ts @@ -2,5 +2,5 @@ export type _msg = { alert: (title: string, message?: string | {[key: string]: any}, callback?: (result?: boolean)=>void) => void confirm: (title: string, message?: string | {[key: string]: any}, callback?: (result: boolean)=>void) => void prompt: (title: string, message?: string, value?: any, callback?: (result: string) => void, minWidth?: number) => void - toast: (message: string, options?: object, context?: HTMLElement) => void + toast: (message: string, options?: object | string, context?: HTMLElement) => void } diff --git a/typescript/case/combo/bubblecombo/combo.bubble.ts b/typescript/case/combo/bubblecombo/combo.bubble.ts index cd50d722b..d5366233f 100644 --- a/typescript/case/combo/bubblecombo/combo.bubble.ts +++ b/typescript/case/combo/bubblecombo/combo.bubble.ts @@ -17,4 +17,8 @@ export declare class BubbleCombo extends Widget { showView(): void; isViewVisible(): boolean; + + adjustWidth(e?:MouseEvent): void; + + adjustHeight(e?: MouseEvent): void; } diff --git a/webpack/webpack.dev.js b/webpack/webpack.dev.js index d3c0fb5bc..9e5a21432 100644 --- a/webpack/webpack.dev.js +++ b/webpack/webpack.dev.js @@ -36,11 +36,17 @@ module.exports = merge(common, { output: { path: dirs.DEST, filename: "[name].js", + publicPath: '/', }, devServer: { contentBase: path.join(__dirname, ".."), port: 9001, liveReload: true, + historyApiFallback: { + rewrites: [ + { from: /.*/, to: '/index.html' }, + ], + }, }, plugins: [ new MiniCssExtractPlugin({ diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index 7d8dd939c..05cb95648 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -23,6 +23,7 @@ module.exports = merge.smart(common, { utils: attachments.utils, "utils.min": attachments.utils, "fineui_without_jquery_polyfill": attachments.fineuiWithoutJqueryAndPolyfillJs, + "fineui_without_jquery_polyfill.min": attachments.fineuiWithoutJqueryAndPolyfillJs, "2.0/fineui": attachments.bundle, "2.0/fineui.min": attachments.bundle, "2.0/fineui_without_normalize": attachments.bundleWithoutNormalize,