diff --git a/src/component/allvaluechooser/abstract.allvaluechooser.js b/src/component/allvaluechooser/abstract.allvaluechooser.js index 90cd4afd0..c13d8a30f 100644 --- a/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -40,6 +40,18 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { return text; }, + _getItemsByTimes: function (items, times) { + var res = []; + for (var i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) { + res.push(items[i]); + } + return res; + }, + + _hasNextByTimes: function (items, times) { + return times * this._const.perPage < items.length; + }, + _itemsCreator: function (options, callback) { var self = this, o = this.options; if (!o.cache || !this.items) { @@ -50,13 +62,14 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { } else { call(this.items); } - function call (items) { + + function call(items) { var keywords = (options.keywords || []).slice(); if (options.keyword) { keywords.push(options.keyword); } var resultItems = items; - if(BI.isNotEmptyArray(keywords)) { + if (BI.isNotEmptyArray(keywords)) { resultItems = []; BI.each(keywords, function (i, kw) { var search = BI.Func.getSearchResult(items, kw); @@ -77,12 +90,12 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { return; } if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { - callback({count: resultItems.length}); + callback({ count: resultItems.length }); return; } callback({ - items: resultItems, - hasNext: false + items: self._getItemsByTimes(resultItems, options.times), + hasNext: self._hasNextByTimes(resultItems, options.times) }); } }, @@ -101,4 +114,4 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { } return value; }, -}); \ No newline at end of file +}); diff --git a/src/component/allvaluechooser/pane.allvaluechooser.js b/src/component/allvaluechooser/pane.allvaluechooser.js index 93ad36cba..6188f14ee 100644 --- a/src/component/allvaluechooser/pane.allvaluechooser.js +++ b/src/component/allvaluechooser/pane.allvaluechooser.js @@ -50,10 +50,11 @@ BI.AllValueChooserPane = BI.inherit(BI.AbstractAllValueChooser, { getValue: function () { var val = this.list.getValue() || {}; - if (val.type === BI.Selection.All) { - return val.assist; + if (val.type === BI.Selection.Multi) { + return val.value || []; } - return val.value || []; + + return BI.difference(BI.map(this.items, "value"), val.value || []); }, populate: function (items) { diff --git a/src/less/resource/app.less b/src/less/resource/app.less index 81adda196..e09b2bd15 100644 --- a/src/less/resource/app.less +++ b/src/less/resource/app.less @@ -14,7 +14,6 @@ body { top: 0; left: 0; background-repeat: repeat; - .user-select-disable(); color: @color-bi-text-normal; font: normal 12px "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Heiti, "黑体", sans-serif; -webkit-font-smoothing: antialiased; diff --git a/src/less/typographic.less b/src/less/typographic.less index 27aeba270..f93acf21f 100644 --- a/src/less/typographic.less +++ b/src/less/typographic.less @@ -1,29 +1,30 @@ -.x-overflow-auto(){ +.x-overflow-auto() { overflow-y: hidden; overflow-x: auto; } -.y-overflow-auto(){ +.y-overflow-auto() { overflow-x: hidden; overflow-y: auto; } -.overflow-auto(){ +.overflow-auto() { overflow: auto; overflow-x: auto; overflow-y: auto; } -.overflow-hidden(){ +.overflow-hidden() { overflow: hidden; overflow-x: hidden; overflow-y: hidden; } -.overflow-dot(){ - text-overflow:ellipsis; + +.overflow-dot() { + text-overflow: ellipsis; overflow-x: hidden; overflow-y: hidden; - white-space:nowrap; + white-space: nowrap; } .user-select(@select) { @@ -35,19 +36,10 @@ user-select: @select; } -.user-select-disable(){ - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -o-user-select: none; - user-select: none; -} -.user-select-enable(){ - -webkit-user-select: text; - -khtml-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - -o-user-select: text; - user-select: text; -} \ No newline at end of file +.user-select-disable() { + .user-select(none); +} + +.user-select-enable() { + .user-select(auto); +} diff --git a/src/widget/multiselectlist/multiselectlist.js b/src/widget/multiselectlist/multiselectlist.js index c0a3505ff..eccc18581 100644 --- a/src/widget/multiselectlist/multiselectlist.js +++ b/src/widget/multiselectlist/multiselectlist.js @@ -215,7 +215,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { digest(values); }); - function digest (items) { + function digest(items) { var selectedMap = self._makeMap(items); BI.each(keywords, function (i, val) { if (BI.isNotNull(selectedMap[val])) { @@ -235,7 +235,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { text: o.valueFormatter(v) || v, value: v }; - }), this.trigger.getKey()); + }), this.trigger.getKeyword()); var change = false; var map = this._makeMap(this.storeValue.value); BI.each(BI.concat(result.match, result.find), function (i, obj) { @@ -251,7 +251,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { } o.itemsCreator({ type: BI.MultiSelectList.REQ_GET_ALL_DATA, - keywords: [this.trigger.getKey()], + keywords: [this.trigger.getKeyword()], selectedValues: BI.filter(this.storeValue.value, function (_i, v) { return !BI.contains(res.value, v); }), @@ -288,7 +288,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { callback(); } - function adjust () { + function adjust() { if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { self.storeValue = { type: BI.Selection.Multi, @@ -365,4 +365,4 @@ BI.extend(BI.MultiSelectList, { }); BI.MultiSelectList.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.multi_select_list", BI.MultiSelectList); \ No newline at end of file +BI.shortcut("bi.multi_select_list", BI.MultiSelectList);