Browse Source

Pull request #2907: JSY-12311 默认文字可以赋值

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

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

23
src/component/allvaluechooser/abstract.allvaluechooser.js

@ -40,6 +40,18 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
return text; 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) { _itemsCreator: function (options, callback) {
var self = this, o = this.options; var self = this, o = this.options;
if (!o.cache || !this.items) { if (!o.cache || !this.items) {
@ -50,13 +62,14 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
} else { } else {
call(this.items); call(this.items);
} }
function call (items) {
function call(items) {
var keywords = (options.keywords || []).slice(); var keywords = (options.keywords || []).slice();
if (options.keyword) { if (options.keyword) {
keywords.push(options.keyword); keywords.push(options.keyword);
} }
var resultItems = items; var resultItems = items;
if(BI.isNotEmptyArray(keywords)) { if (BI.isNotEmptyArray(keywords)) {
resultItems = []; resultItems = [];
BI.each(keywords, function (i, kw) { BI.each(keywords, function (i, kw) {
var search = BI.Func.getSearchResult(items, kw); var search = BI.Func.getSearchResult(items, kw);
@ -77,12 +90,12 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
return; return;
} }
if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: resultItems.length}); callback({ count: resultItems.length });
return; return;
} }
callback({ callback({
items: resultItems, items: self._getItemsByTimes(resultItems, options.times),
hasNext: false 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 () { getValue: function () {
var val = this.list.getValue() || {}; var val = this.list.getValue() || {};
if (val.type === BI.Selection.All) { if (val.type === BI.Selection.Multi) {
return val.assist;
}
return val.value || []; return val.value || [];
}
return BI.difference(BI.map(this.items, "value"), val.value || []);
}, },
populate: function (items) { populate: function (items) {

1
src/less/resource/app.less

@ -14,7 +14,6 @@ body {
top: 0; top: 0;
left: 0; left: 0;
background-repeat: repeat; background-repeat: repeat;
.user-select-disable();
color: @color-bi-text-normal; color: @color-bi-text-normal;
font: normal 12px "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Heiti, "黑体", sans-serif; font: normal 12px "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Heiti, "黑体", sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;

36
src/less/typographic.less

@ -1,29 +1,30 @@
.x-overflow-auto(){ .x-overflow-auto() {
overflow-y: hidden; overflow-y: hidden;
overflow-x: auto; overflow-x: auto;
} }
.y-overflow-auto(){ .y-overflow-auto() {
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
.overflow-auto(){ .overflow-auto() {
overflow: auto; overflow: auto;
overflow-x: auto; overflow-x: auto;
overflow-y: auto; overflow-y: auto;
} }
.overflow-hidden(){ .overflow-hidden() {
overflow: hidden; overflow: hidden;
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
} }
.overflow-dot(){
text-overflow:ellipsis; .overflow-dot() {
text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;
overflow-y: hidden; overflow-y: hidden;
white-space:nowrap; white-space: nowrap;
} }
.user-select(@select) { .user-select(@select) {
@ -35,19 +36,10 @@
user-select: @select; user-select: @select;
} }
.user-select-disable(){ .user-select-disable() {
-webkit-user-select: none; .user-select(none);
-khtml-user-select: none; }
-moz-user-select: none;
-ms-user-select: none; .user-select-enable() {
-o-user-select: none; .user-select(auto);
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;
} }

8
src/widget/multiselectlist/multiselectlist.js

@ -215,7 +215,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
digest(values); digest(values);
}); });
function digest (items) { function digest(items) {
var selectedMap = self._makeMap(items); var selectedMap = self._makeMap(items);
BI.each(keywords, function (i, val) { BI.each(keywords, function (i, val) {
if (BI.isNotNull(selectedMap[val])) { if (BI.isNotNull(selectedMap[val])) {
@ -235,7 +235,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
text: o.valueFormatter(v) || v, text: o.valueFormatter(v) || v,
value: v value: v
}; };
}), this.trigger.getKey()); }), this.trigger.getKeyword());
var change = false; var change = false;
var map = this._makeMap(this.storeValue.value); var map = this._makeMap(this.storeValue.value);
BI.each(BI.concat(result.match, result.find), function (i, obj) { BI.each(BI.concat(result.match, result.find), function (i, obj) {
@ -251,7 +251,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
} }
o.itemsCreator({ o.itemsCreator({
type: BI.MultiSelectList.REQ_GET_ALL_DATA, type: BI.MultiSelectList.REQ_GET_ALL_DATA,
keywords: [this.trigger.getKey()], keywords: [this.trigger.getKeyword()],
selectedValues: BI.filter(this.storeValue.value, function (_i, v) { selectedValues: BI.filter(this.storeValue.value, function (_i, v) {
return !BI.contains(res.value, v); return !BI.contains(res.value, v);
}), }),
@ -288,7 +288,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, {
callback(); callback();
} }
function adjust () { function adjust() {
if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) {
self.storeValue = { self.storeValue = {
type: BI.Selection.Multi, type: BI.Selection.Multi,

Loading…
Cancel
Save