Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~dailer/fineui

es6
zsmj 2 years ago
parent
commit
53f9507062
  1. 2
      package.json
  2. 22
      src/widget/multiselect/check/multiselect.display.js
  3. 9
      src/widget/multiselect/loader.js
  4. 2
      src/widget/singleselect/trigger/searcher.singleselect.js

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20221018090412", "version": "2.0.20221018171414",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

22
src/widget/multiselect/check/multiselect.display.js

@ -26,6 +26,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
var self = this, opts = this.options; var self = this, opts = this.options;
this.hasNext = false; this.hasNext = false;
var cacheItems = [];
this.button_group = BI.createWidget({ this.button_group = BI.createWidget({
type: "bi.list_pane", type: "bi.list_pane",
@ -45,10 +46,29 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
}] }]
}, },
itemsCreator: function (options, callback) { itemsCreator: function (options, callback) {
if (options.times === 1) {
cacheItems = [];
}
if (cacheItems.length > 0) {
var renderedItems = cacheItems.slice(0, 100);
cacheItems = cacheItems.slice(100);
self.hasNext = true;
if (cacheItems.length === 0) {
self.hasNext = false;
}
callback(self._createItems(renderedItems));
return;
}
opts.itemsCreator(options, function (ob) { opts.itemsCreator(options, function (ob) {
self.hasNext = !!ob.hasNext; self.hasNext = !!ob.hasNext;
callback(self._createItems(ob.items)); var firstItemsCount = 100 + ob.items.length % 100;
if (ob.items.length > 100) {
cacheItems = ob.items.slice(100 + ob.items.length % 100);
self.hasNext = true;
}
callback(self._createItems(ob.items.slice(0, firstItemsCount)));
}); });
}, },
hasNext: function () { hasNext: function () {

9
src/widget/multiselect/loader.js

@ -167,7 +167,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
}]); }]);
return false; return false;
} }
this.options.items = (items || []).slice(0, 100); this.options.items = (items || []).slice(0, 100 + (items || []).length % 100);
this.times = 1; this.times = 1;
this.count = 0; this.count = 0;
this.count += items.length; this.count += items.length;
@ -184,14 +184,15 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, {
populate: function (items, keyword) { populate: function (items, keyword) {
if (this._populate.apply(this, arguments)) { if (this._populate.apply(this, arguments)) {
this.cachItems = []; this.cachItems = [];
if (items.length > 100) { var firstItemsCount = 100 + items.length % 100;
this.cachItems = items.slice(100); if (items.length > firstItemsCount) {
this.cachItems = items.slice(firstItemsCount);
} }
var renderEngine = BI.Widget._renderEngine; var renderEngine = BI.Widget._renderEngine;
BI.Widget.registerRenderEngine(BI.Element.renderEngine); BI.Widget.registerRenderEngine(BI.Element.renderEngine);
this.cachGroup.populate.call(this.cachGroup, items, keyword); this.cachGroup.populate.call(this.cachGroup, items, keyword);
BI.Widget.registerRenderEngine(renderEngine); BI.Widget.registerRenderEngine(renderEngine);
this.button_group.populate.call(this.button_group, items.slice(0, 100), keyword); this.button_group.populate.call(this.button_group, items.slice(0, firstItemsCount), keyword);
} }
}, },

2
src/widget/singleselect/trigger/searcher.singleselect.js

@ -128,7 +128,7 @@ BI.SingleSelectSearcher = BI.inherit(BI.Widget, {
if (BI.isUndefined(v)) { if (BI.isUndefined(v)) {
this.editor.setState(BI.Selection.None); this.editor.setState(BI.Selection.None);
} else { } else {
v = v || ""; v = v ?? "";
this.editor.setState(o.valueFormatter(v + "") || (v + "")); this.editor.setState(o.valueFormatter(v + "") || (v + ""));
} }
}, },

Loading…
Cancel
Save