From acada738b5d2f682fcfae3151ed2349be8bc80b4 Mon Sep 17 00:00:00 2001 From: unknown <1374721899@qq.com> Date: Wed, 19 Jun 2019 21:28:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=88=87=E7=95=B0?= =?UTF-8?q?=E6=AD=A5=E7=9A=84=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multilayerselecttree/multilayerselecttree.leveltree.js | 4 +++- src/widget/multilayerselecttree/multilayerselecttree.popup.js | 1 + .../multilayersingletree/multilayersingletree.leveltree.js | 4 +++- src/widget/multilayersingletree/multilayersingletree.popup.js | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index 2c3b9a0dc..ae0ddb11e 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -9,6 +9,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", isDefaultInit: false, + async: false, items: [], itemsCreator: BI.emptyFn, keywordGetter: BI.emptyFn, @@ -97,7 +98,8 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { el: { type: "bi.loader", - isDefaultInit: true, + // loader的isDefaultInit为异步加载服务,如果是同步选择不开启 + isDefaultInit: o.async, chooseType: o.chooseType, el: { type: "bi.button_tree", diff --git a/src/widget/multilayerselecttree/multilayerselecttree.popup.js b/src/widget/multilayerselecttree/multilayerselecttree.popup.js index b2e904e54..cb3807815 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.popup.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.popup.js @@ -26,6 +26,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree = BI.createWidget({ type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, + async: o.itemsCreator !== BI.emptyFn, items: o.items, itemsCreator: function (op, callback) { (op.times === 1 && !op.node) && BI.nextTick(function () { diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index f2d9ff1f4..378658128 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -9,6 +9,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", isDefaultInit: false, + async: false, items: [], itemsCreator: BI.emptyFn, keywordGetter: BI.emptyFn, @@ -96,7 +97,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { el: { type: "bi.loader", - isDefaultInit: true, + // loader的isDefaultInit为异步加载服务,如果是同步选择不开启 + isDefaultInit: o.async, chooseType: o.chooseType, el: { type: "bi.button_tree", diff --git a/src/widget/multilayersingletree/multilayersingletree.popup.js b/src/widget/multilayersingletree/multilayersingletree.popup.js index 7e9aca6f9..37a9601b1 100644 --- a/src/widget/multilayersingletree/multilayersingletree.popup.js +++ b/src/widget/multilayersingletree/multilayersingletree.popup.js @@ -25,6 +25,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree = BI.createWidget({ type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, + async: o.itemsCreator !== BI.emptyFn, items: o.items, itemsCreator: function (op, callback) { (op.times === 1 && !op.node) && BI.nextTick(function () { From 4613f83844453f3e5f9906d1e30c45f87e3d70a0 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 20 Jun 2019 11:51:24 +0800 Subject: [PATCH 2/5] =?UTF-8?q?BI-46525=20fix:=20value=E5=92=8C=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E5=8A=A0=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multilayerselecttree/multilayerselecttree.combo.js | 9 ++++++++- .../multilayerselecttree.leveltree.js | 4 +--- .../multilayerselecttree/multilayerselecttree.popup.js | 1 - .../multilayersingletree/multilayersingletree.combo.js | 9 ++++++++- .../multilayersingletree.leveltree.js | 4 +--- .../multilayersingletree/multilayersingletree.popup.js | 1 - 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index ee8dbd9b9..e57419376 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -23,6 +23,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; + this.storeValue = BI.isArray(o.value) ? o.value[0] : o.value; var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : { @@ -139,17 +140,23 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { action: function () { self.trigger.stopEditing(); } + }, { + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.populate(); + } }] }); }, setValue: function (v) { v = BI.isArray(v) ? v : [v]; + this.storeValue = v[0]; this.combo.setValue(v); }, getValue: function () { - return this.combo.getValue(); + return [this.storeValue]; }, populate: function (items) { diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index ae0ddb11e..2c3b9a0dc 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -9,7 +9,6 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", isDefaultInit: false, - async: false, items: [], itemsCreator: BI.emptyFn, keywordGetter: BI.emptyFn, @@ -98,8 +97,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { el: { type: "bi.loader", - // loader的isDefaultInit为异步加载服务,如果是同步选择不开启 - isDefaultInit: o.async, + isDefaultInit: true, chooseType: o.chooseType, el: { type: "bi.button_tree", diff --git a/src/widget/multilayerselecttree/multilayerselecttree.popup.js b/src/widget/multilayerselecttree/multilayerselecttree.popup.js index cb3807815..b2e904e54 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.popup.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.popup.js @@ -26,7 +26,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree = BI.createWidget({ type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, - async: o.itemsCreator !== BI.emptyFn, items: o.items, itemsCreator: function (op, callback) { (op.times === 1 && !op.node) && BI.nextTick(function () { diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index c2312cbcb..0e7f51be0 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -26,6 +26,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; + this.storeValue = BI.isArray(o.value) ? o.value[0] : o.value; var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : { @@ -142,17 +143,23 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { action: function () { self.trigger.stopEditing(); } + }, { + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.populate(); + } }] }); }, setValue: function (v) { v = BI.isArray(v) ? v : [v]; + this.storeValue = v[0]; this.combo.setValue(v); }, getValue: function () { - return this.combo.getValue(); + return [this.storeValue]; }, populate: function (items) { diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index 378658128..f2d9ff1f4 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -9,7 +9,6 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", isDefaultInit: false, - async: false, items: [], itemsCreator: BI.emptyFn, keywordGetter: BI.emptyFn, @@ -97,8 +96,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { el: { type: "bi.loader", - // loader的isDefaultInit为异步加载服务,如果是同步选择不开启 - isDefaultInit: o.async, + isDefaultInit: true, chooseType: o.chooseType, el: { type: "bi.button_tree", diff --git a/src/widget/multilayersingletree/multilayersingletree.popup.js b/src/widget/multilayersingletree/multilayersingletree.popup.js index 37a9601b1..7e9aca6f9 100644 --- a/src/widget/multilayersingletree/multilayersingletree.popup.js +++ b/src/widget/multilayersingletree/multilayersingletree.popup.js @@ -25,7 +25,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree = BI.createWidget({ type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, - async: o.itemsCreator !== BI.emptyFn, items: o.items, itemsCreator: function (op, callback) { (op.times === 1 && !op.node) && BI.nextTick(function () { From ba5730ae6d4d02492f9fdb3718f6ab1add927b4e Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 20 Jun 2019 12:31:14 +0800 Subject: [PATCH 3/5] update --- src/widget/multilayerselecttree/multilayerselecttree.combo.js | 2 +- .../multilayerselecttree/multilayerselecttree.leveltree.js | 2 +- src/widget/multilayersingletree/multilayersingletree.combo.js | 2 +- .../multilayersingletree/multilayersingletree.leveltree.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index e57419376..4d6f3ddad 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -86,7 +86,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index 2c3b9a0dc..4141db1af 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -97,7 +97,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 0e7f51be0..024e5af2f 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -89,7 +89,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index f2d9ff1f4..dca444ba4 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -96,7 +96,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", From d63739c8c5086523d997a853ac9b5b37896845a3 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 20 Jun 2019 14:28:08 +0800 Subject: [PATCH 4/5] update --- dist/2.0/fineui.ie.js | 102 +++++++++--------- dist/2.0/fineui.js | 102 +++++++++--------- dist/bundle.ie.js | 102 +++++++++--------- dist/bundle.js | 102 +++++++++--------- dist/fineui.ie.js | 102 +++++++++--------- dist/fineui.js | 102 +++++++++--------- dist/fineui_without_jquery_polyfill.js | 102 +++++++++--------- dist/widget.js | 102 +++++++++--------- .../multilayerselecttree.combo.js | 9 +- .../multilayerselecttree.leveltree.js | 28 ++++- .../multilayerselecttree.popup.js | 22 +--- .../multilayersingletree.combo.js | 9 +- .../multilayersingletree.leveltree.js | 24 ++++- .../multilayersingletree.popup.js | 22 +--- 14 files changed, 449 insertions(+), 481 deletions(-) diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 41ccbeda1..5dcc02994 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -68927,7 +68927,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69006,7 +69006,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -69020,9 +69020,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -69090,16 +69095,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -69113,9 +69126,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -69128,16 +69142,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -69161,7 +69181,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -69183,18 +69203,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -69216,12 +69225,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -69234,7 +69237,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -69856,7 +69858,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69935,7 +69937,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -69952,6 +69954,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -70019,15 +70023,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -70044,6 +70056,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -70056,19 +70069,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -70093,7 +70109,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -70114,18 +70130,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -70147,12 +70152,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -70165,7 +70164,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index 86fb0ecf1..52cb586af 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -69331,7 +69331,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69410,7 +69410,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -69424,9 +69424,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -69494,16 +69499,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -69517,9 +69530,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -69532,16 +69546,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -69565,7 +69585,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -69587,18 +69607,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -69620,12 +69629,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -69638,7 +69641,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -70260,7 +70262,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -70339,7 +70341,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -70356,6 +70358,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -70423,15 +70427,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -70448,6 +70460,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -70460,19 +70473,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -70497,7 +70513,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -70518,18 +70534,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -70551,12 +70556,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -70569,7 +70568,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 41ccbeda1..5dcc02994 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -68927,7 +68927,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69006,7 +69006,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -69020,9 +69020,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -69090,16 +69095,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -69113,9 +69126,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -69128,16 +69142,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -69161,7 +69181,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -69183,18 +69203,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -69216,12 +69225,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -69234,7 +69237,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -69856,7 +69858,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69935,7 +69937,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -69952,6 +69954,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -70019,15 +70023,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -70044,6 +70056,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -70056,19 +70069,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -70093,7 +70109,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -70114,18 +70130,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -70147,12 +70152,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -70165,7 +70164,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/bundle.js b/dist/bundle.js index 86fb0ecf1..52cb586af 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -69331,7 +69331,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69410,7 +69410,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -69424,9 +69424,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -69494,16 +69499,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -69517,9 +69530,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -69532,16 +69546,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -69565,7 +69585,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -69587,18 +69607,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -69620,12 +69629,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -69638,7 +69641,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -70260,7 +70262,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -70339,7 +70341,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -70356,6 +70358,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -70423,15 +70427,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -70448,6 +70460,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -70460,19 +70473,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -70497,7 +70513,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -70518,18 +70534,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -70551,12 +70556,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -70569,7 +70568,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index d1d540351..b83d9ff77 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -69172,7 +69172,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69251,7 +69251,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -69265,9 +69265,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -69335,16 +69340,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -69358,9 +69371,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -69373,16 +69387,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -69406,7 +69426,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -69428,18 +69448,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -69461,12 +69470,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -69479,7 +69482,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -70101,7 +70103,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -70180,7 +70182,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -70197,6 +70199,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -70264,15 +70268,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -70289,6 +70301,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -70301,19 +70314,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -70338,7 +70354,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -70359,18 +70375,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -70392,12 +70397,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -70410,7 +70409,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/fineui.js b/dist/fineui.js index f26ff1a4a..3eaf4a772 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -69576,7 +69576,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -69655,7 +69655,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -69669,9 +69669,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -69739,16 +69744,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -69762,9 +69775,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -69777,16 +69791,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -69810,7 +69830,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -69832,18 +69852,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -69865,12 +69874,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -69883,7 +69886,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -70505,7 +70507,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -70584,7 +70586,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -70601,6 +70603,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -70668,15 +70672,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -70693,6 +70705,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -70705,19 +70718,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -70742,7 +70758,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -70763,18 +70779,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -70796,12 +70801,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -70814,7 +70813,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 022f2c611..ff447670b 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -51915,7 +51915,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -51994,7 +51994,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -52008,9 +52008,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -52078,16 +52083,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -52101,9 +52114,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -52116,16 +52130,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -52149,7 +52169,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -52171,18 +52191,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -52204,12 +52213,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -52222,7 +52225,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -52844,7 +52846,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -52923,7 +52925,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -52940,6 +52942,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -53007,15 +53011,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -53032,6 +53044,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -53044,19 +53057,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -53081,7 +53097,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -53102,18 +53118,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -53135,12 +53140,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -53153,7 +53152,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/dist/widget.js b/dist/widget.js index 54155e2a9..b0d1413d3 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -6691,7 +6691,7 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -6770,7 +6770,7 @@ BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -6784,9 +6784,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -6854,16 +6859,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -6877,9 +6890,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -6892,16 +6906,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -6925,7 +6945,7 @@ BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -6947,18 +6967,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -6980,12 +6989,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -6998,7 +7001,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); @@ -7620,7 +7622,7 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { }] }, value: o.value, - minHeight: 400 + maxHeight: 400 } }; }, @@ -7699,7 +7701,7 @@ BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -7716,6 +7718,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -7783,15 +7787,23 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, el: { type: "bi.loader", - isDefaultInit: true, + isDefaultInit: false, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -7808,6 +7820,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -7820,19 +7833,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { @@ -7857,7 +7873,7 @@ BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -7878,18 +7894,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -7911,12 +7916,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -7929,7 +7928,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/src/widget/multilayerselecttree/multilayerselecttree.combo.js b/src/widget/multilayerselecttree/multilayerselecttree.combo.js index 4d6f3ddad..cb0015f68 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.combo.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.combo.js @@ -23,7 +23,6 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; - this.storeValue = BI.isArray(o.value) ? o.value[0] : o.value; var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : { @@ -140,23 +139,17 @@ BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { action: function () { self.trigger.stopEditing(); } - }, { - eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, - action: function () { - self.populate(); - } }] }); }, setValue: function (v) { v = BI.isArray(v) ? v : [v]; - this.storeValue = v[0]; this.combo.setValue(v); }, getValue: function () { - return [this.storeValue]; + return this.combo.getValue(); }, populate: function (items) { diff --git a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js index 4141db1af..752416570 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.leveltree.js @@ -4,7 +4,7 @@ * @class BI.MultiLayerSelectLevelTree * @extends BI.Select */ -BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-select-level-tree", @@ -18,9 +18,14 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }, _init: function () { + var o = this.options; BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + this.storeValue = o.value; + this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -88,16 +93,24 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, value: o.value, el: { type: "bi.loader", - isDefaultInit: false, + isDefaultInit: o.itemsCreator !== BI.emptyFn, chooseType: o.chooseType, el: { type: "bi.button_tree", @@ -111,9 +124,10 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { } } }); - this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, value) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(value); self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); } }); @@ -126,16 +140,22 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.uniq(this.tree.getValue()); + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { diff --git a/src/widget/multilayerselecttree/multilayerselecttree.popup.js b/src/widget/multilayerselecttree/multilayerselecttree.popup.js index b2e904e54..7b4ec3f0f 100644 --- a/src/widget/multilayerselecttree/multilayerselecttree.popup.js +++ b/src/widget/multilayerselecttree/multilayerselecttree.popup.js @@ -5,7 +5,7 @@ * @extends BI.Pane */ -BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -27,18 +27,7 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_select_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -60,12 +49,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -78,7 +61,6 @@ BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); diff --git a/src/widget/multilayersingletree/multilayersingletree.combo.js b/src/widget/multilayersingletree/multilayersingletree.combo.js index 024e5af2f..289e2564c 100644 --- a/src/widget/multilayersingletree/multilayersingletree.combo.js +++ b/src/widget/multilayersingletree/multilayersingletree.combo.js @@ -26,7 +26,6 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; - this.storeValue = BI.isArray(o.value) ? o.value[0] : o.value; var combo = (o.itemsCreator === BI.emptyFn) ? this._getSyncConfig() : this._getAsyncConfig(); return (!o.allowEdit && o.itemsCreator === BI.emptyFn) ? combo : { @@ -143,23 +142,17 @@ BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { action: function () { self.trigger.stopEditing(); } - }, { - eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, - action: function () { - self.populate(); - } }] }); }, setValue: function (v) { v = BI.isArray(v) ? v : [v]; - this.storeValue = v[0]; this.combo.setValue(v); }, getValue: function () { - return [this.storeValue]; + return this.combo.getValue(); }, populate: function (items) { diff --git a/src/widget/multilayersingletree/multilayersingletree.leveltree.js b/src/widget/multilayersingletree/multilayersingletree.leveltree.js index dca444ba4..ced457acf 100644 --- a/src/widget/multilayersingletree/multilayersingletree.leveltree.js +++ b/src/widget/multilayersingletree/multilayersingletree.leveltree.js @@ -4,7 +4,7 @@ * @class BI.MultiLayerSingleLevelTree * @extends BI.Single */ -BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-multilayer-single-level-tree", @@ -21,6 +21,8 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); this.initTree(this.options.items); + + this.check(); }, _formatItems: function (nodes, layer, pNode) { @@ -88,9 +90,17 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), value: o.value, itemsCreator: function (op, callback) { + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loading(); + }); o.itemsCreator(op, function (ob) { hasNext = ob.hasNext; + self._populate(ob.items); callback(self._formatItems(BI.Tree.transformToTreeFormat(ob.items), op.node ? op.node.layer + 1 : 0, op.node)); + self.setValue(self.storeValue); + (op.times === 1 && !op.node) && BI.nextTick(function () { + self.loaded(); + }); }); }, @@ -113,6 +123,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); if (type === BI.Events.CLICK) { + self.setValue(v); self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); } }); @@ -125,19 +136,22 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { }); }, + _populate: function () { + BI.MultiLayerSelectLevelTree.superclass.populate.apply(this, arguments); + }, + populate: function (nodes) { + this._populate(nodes); BI.isNull(nodes) ? this.tree.populate() : this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); }, setValue: function (v) { + this.storeValue = v; this.tree.setValue(v); }, getValue: function () { - return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) { - return BI.isNotNull(value); - }); - + return BI.isArray(this.storeValue) ? this.storeValue : [this.storeValue]; }, getAllLeaves: function () { diff --git a/src/widget/multilayersingletree/multilayersingletree.popup.js b/src/widget/multilayersingletree/multilayersingletree.popup.js index 7e9aca6f9..f0e100101 100644 --- a/src/widget/multilayersingletree/multilayersingletree.popup.js +++ b/src/widget/multilayersingletree/multilayersingletree.popup.js @@ -5,7 +5,7 @@ * @extends BI.Pane */ -BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Widget, { _defaultConfig: function () { return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { @@ -26,18 +26,7 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { type: "bi.multilayer_single_level_tree", isDefaultInit: o.isDefaultInit, items: o.items, - itemsCreator: function (op, callback) { - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loading(); - }); - o.itemsCreator(op, function (ob) { - self._populate(ob.items); - callback(ob); - (op.times === 1 && !op.node) && BI.nextTick(function () { - self.loaded(); - }); - }); - }, + itemsCreator: o.itemsCreator, keywordGetter: o.keywordGetter, value: o.value, scrollable: null @@ -59,12 +48,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); }); - - this.check(); - }, - - _populate: function() { - BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); }, getValue: function () { @@ -77,7 +60,6 @@ BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { }, populate: function (items) { - this._populate(items); this.tree.populate(items); } }); From 9ca5038918ebe61fd0591ac391e2517c2f8315f1 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 20 Jun 2019 16:13:26 +0800 Subject: [PATCH 5/5] =?UTF-8?q?BI-46489=20fix:=20encrypt=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/base.js | 110 +++--------------------------------------- src/core/utils/aes.js | 3 ++ 2 files changed, 9 insertions(+), 104 deletions(-) diff --git a/src/core/base.js b/src/core/base.js index 1a44db3f6..1ea3bf25b 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -906,112 +906,14 @@ if (!_global.BI) { }, /** - * 对字符串进行加密 {@link #decrypt} - * @static - * @param str 原始字符�? - * @param keyt 密钥 - * @returns {String} 加密后的字符�? - */ - encrypt: function (str, keyt) { - if (str == "") { - return ""; - } - str = escape(str); - if (!keyt || keyt == "") { - keyt = "655"; - } - keyt = escape(keyt); - if (keyt == null || keyt.length <= 0) { - alert("Please enter a password with which to encrypt the message."); - return null; - } - var prand = ""; - for (var i = 0; i < keyt.length; i++) { - prand += keyt.charCodeAt(i).toString(); - } - var sPos = Math.floor(prand.length / 5); - var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos * 2) + prand.charAt(sPos * 3) + prand.charAt(sPos * 4) + prand.charAt(sPos * 5)); - - var incr = Math.ceil(keyt.length / 2); - var modu = Math.pow(2, 31) - 1; - if (mult < 2) { - alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password."); - return null; - } - // var salt = Math.round(Math.random() * 1000000000) % 100000000; - var salt = 101; - prand += salt; - while (prand.length > 10) { - prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length), 10)).toString(); - } - prand = (mult * prand + incr) % modu; - var enc_chr = ""; - var enc_str = ""; - for (var i = 0; i < str.length; i++) { - enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255)); - if (enc_chr < 16) { - enc_str += "0" + enc_chr.toString(16); - } else { - enc_str += enc_chr.toString(16); - } - prand = (mult * prand + incr) % modu; - } - salt = salt.toString(16); - while (salt.length < 8) { - salt = "0" + salt; - } - enc_str += salt; - return enc_str; - }, - - /** - * 对加密后的字符串解密 {@link #encrypt} - * @static - * @param str 加密过的字符�? - * @param keyt 密钥 - * @returns {String} 解密后的字符�? + * 通用加密方法 */ - decrypt: function (str, keyt) { - if (str == "") { - return ""; + encrypt: function (type, text, key) { + switch (type) { + case BI.CRYPT_TYPE.AES: + default: + return BI.aesEncrypt(text, key); } - if (!keyt || keyt == "") { - keyt = "655"; - } - keyt = escape(keyt); - if (str == null || str.length < 8) { - return; - } - if (keyt == null || keyt.length <= 0) { - return; - } - var prand = ""; - for (var i = 0; i < keyt.length; i++) { - prand += keyt.charCodeAt(i).toString(); - } - var sPos = Math.floor(prand.length / 5); - var tempmult = prand.charAt(sPos) + prand.charAt(sPos * 2) + prand.charAt(sPos * 3) + prand.charAt(sPos * 4); - if (sPos * 5 < prand.length) { - tempmult += prand.charAt(sPos * 5); - } - var mult = parseInt(tempmult); - var incr = Math.round(keyt.length / 2); - var modu = Math.pow(2, 31) - 1; - var salt = parseInt(str.substring(str.length - 8, str.length), 16); - str = str.substring(0, str.length - 8); - prand += salt; - while (prand.length > 10) { - prand = (parseInt(prand.substring(0, 10), 10) + parseInt(prand.substring(10, prand.length), 10)).toString(); - } - prand = (mult * prand + incr) % modu; - var enc_chr = ""; - var enc_str = ""; - for (var i = 0; i < str.length; i += 2) { - enc_chr = parseInt(parseInt(str.substring(i, i + 2), 16) ^ Math.floor((prand / modu) * 255)); - enc_str += String.fromCharCode(enc_chr); - prand = (mult * prand + incr) % modu; - } - return unescape(enc_str); }, /** diff --git a/src/core/utils/aes.js b/src/core/utils/aes.js index 28a4aa8f0..9971ebdd4 100644 --- a/src/core/utils/aes.js +++ b/src/core/utils/aes.js @@ -8,6 +8,9 @@ /** * CryptoJS core components. */ + BI.CRYPT_TYPE = BI.CRYPT_TYPE || {}; + BI.CRYPT_TYPE.AES = "aes"; + var CryptoJS = CryptoJS || (function (Math, undefined) { /** * CryptoJS namespace.