Browse Source

Merge pull request #99002 in DEC/fineui from master to feature/x

* commit 'badf3a1acd78bcb4302235e8f74b8c9ef391bb11':
  JSY-12311 默认文字可以赋值
  KERNEL-10944 feat: AllValueChooser内置分页逻辑
es6
superman 2 years ago
parent
commit
8c3ba47d30
  1. 17
      src/component/allvaluechooser/abstract.allvaluechooser.js
  2. 7
      src/component/allvaluechooser/pane.allvaluechooser.js
  3. 1
      src/less/resource/app.less
  4. 16
      src/less/typographic.less
  5. 4
      src/widget/multiselectlist/multiselectlist.js

17
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,6 +62,7 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
} else {
call(this.items);
}
function call(items) {
var keywords = (options.keywords || []).slice();
if (options.keyword) {
@ -81,8 +94,8 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
return;
}
callback({
items: resultItems,
hasNext: false
items: self._getItemsByTimes(resultItems, options.times),
hasNext: self._hasNextByTimes(resultItems, options.times)
});
}
},

7
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 BI.difference(BI.map(this.items, "value"), val.value || []);
},
populate: function (items) {

1
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;

16
src/less/typographic.less

@ -19,6 +19,7 @@
overflow-x: hidden;
overflow-y: hidden;
}
.overflow-dot() {
text-overflow: ellipsis;
overflow-x: hidden;
@ -36,18 +37,9 @@
}
.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(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;
.user-select(auto);
}

4
src/widget/multiselectlist/multiselectlist.js

@ -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);
}),

Loading…
Cancel
Save